DHTML Lab: Hierarchical Menus Ver. 2 (Cross-Browser/Frames); Introduction
Hierarchical Menus Ver. 2 (Cross-Browser/Frames)
Parameters used for the menus on this page:
menuWidth = 150; childOverlap = 20; childOffset = 5; perCentOver = null; secondsVisible = .8; fntCol = "black"; fntSiz = 9; fntBold = 1; fntItal = false; fntFam = "serif"; backCol = "#EEEEEE"; overCol = "#CCCCCC"; overFnt = "green"; borWid = 2; borCol = "green"; borSty = "solid"; itemPad = 5; imgSrc = "tri.gif"; imgSiz = 8; separator = 1; separatorCol = ""; isFrames = false;
Keep Those Letters Coming
The feedback on version 1 revolved around these issues:
General Script Functionality:
Version 2 addresses all the above.
Frame and single window functionality has been combined into one script. A Boolean parameter variable, isFrames, toggles the type of menus created. Instead of three separate functions for the three menu levels, version 2 uses a single recursive function that allows for any number of levels, depending only on the number of menu arrays defined.
A new parameter variable, navFrLoc, allows for navigation frames on any of the four sides. If the main frame page code is omitted, menus can still appear in frame-based layouts, by being created on demand, after the main frame loads.
The logic for the Navigator-specific code has been completely changed, moving from the layer-CSS combination of version 1, to a solely dynamic layer-based one. The result is a no-surprises stability. The onfocus() handler for detecting menu clicks has been replaced, and the DHTML Diner resize code has been drafted to handle the resize problem.
Finally, authors are given greater flexibility in defining the look of the menus. Borders are no longer applied to every item, but to each menu as a whole. Provision is made for separator lines between items.
We will move through the version 2 script line-by-line, emphasizing and detailing only what is new. It will be assumed that you are familiar with the version 1 script.
Let's start with a look at our parameter variables and our in-page script and HTML.
Produced by Peter Belesis andAll Rights Reserved. Legal Notices.
Created: May. 22, 1998
Revised: May. 22, 1998