DHTML Lab: Hierarchical Menus Ver. 2 - Addendum (v2.1) | 3 | WebReference

DHTML Lab: Hierarchical Menus Ver. 2 - Addendum (v2.1) | 3


Logo

Hierarchical Menus Ver. 2 - Addendum (v2.1)
additional features

Other Menu URLs

Script URLs

Click the links above to reveal menus.

Click the button above for frame-related mods.

Menu Animated GIF
Animated GIF demonstrating heirarchical menus for non-DHTML browsers.

Can't See the Forest...

Many queries revolve around associating a different action with the linkIt() function, which presently has this syntax:

function linkIt() {
    menuLoc.location.href = this.linkText;
}

The linkText property for every item represents the second array element in each group of three defined in hierArrays.js. In the following, the purple elements become linkText properties:

arMenu1 = new Array(
"Experts","http://www.webreference.com/experts/",1,
"Contents","http://www.webreference.com/index2.html",1,
"Services","http://www.webreference.com/index2.html",1,
"About","http://www.webreference.com/about.html",0
)

They are simple http: URLs. We could, therefore, use other valid URLs in their place. The first menu in the left column is created from this array:

arMenu1 = new Array(
"MailTo","mailto:pbel@foo.bar",0,
"Gopher","gopher://gopher.tc.umn.edu:70/",0,
"FTP","ftp://sunsite.unc.edu/",0,
"View Source",
 "view-source:http://www.webreference.com/dhtml/column20/addendum/",0
)

That's all we have to do. Since the JavaScript location.href is identical to the HTML HREF=, any URL that can be included as a value of HREF= is valid.

Try the menu item links. You'll agree that nothing could be more straightforward. It truly is a case of "couldn't see the forest for the trees."

Almost as easy is the inclusion of javascript: URLs to execute script statements.


Produced by Peter Belesis and

All Rights Reserved. Legal Notices.
Created: June 29, 1998
Revised: June 29, 1998

URL: http://www.webreference.com/dhtml/column20/addendum/col20add3.html