DHTML Lab: Hierarchical Menus Ver. 2 (Cross-Browser/Frames); Wrap-up
Hierarchical Menus Ver. 2 (Cross-Browser/Frames)
|
|||
Parameters used for the menus on this page: menuWidth = 100; childOverlap = 40; childOffset = 3; perCentOver = null; secondsVisible = .7; fntCol = "black"; fntSiz = 8; fntBold = true; fntItal = false; fntFam = "sans-serif"; backCol = "#DDDDDD"; overCol = "#FFCCCC"; overFnt = "purple"; borWid = 1; borCol = "black"; borSty = "solid"; itemPad = 1; imgSrc = "tri.gif"; imgSiz = 6; separator = 1; separatorCol = "black"; isFrames = false; In longer script listings, cross-browser code is blue, Navigator-specific code is red, and Explorer code is green. The [cc] symbol denotes code continuation. The code is part of the preceding line. It is placed on a new line for column formatting considerations only. |
Miscellaneous FunctionsWe set the onselectstart event handler for menu elements, in the Explorer-specific part of menuSetup(). It calls cancelSelect(), which disallows distracting highlighting of content within menus (same as Version 1): function cancelSelect() { return false } In the startIt() function, we set the resize handler for Navigator to call reDo(), which simply reloads the page, assuring any DHTML is laid out correctly. function reDo() { menuLoc.location.reload() } Ensuring Frame Menus Upon Page LoadVersion 2 will create menus in a frameset regardless of whether the author has access to pages loaded in the main frame, and with no additional code necessary. For faster menu creation, you can insert this onLoad handler in the BODY tag of any main frame page, as with Version 1. This way, the menus will be created when the frame page loads: <BODY onLoad="if(parent.frames.nav && [cc] parent.frames.nav.startIt)parent.frames.nav.startIt()"> Our ApologiesHierarchical Menus Version 2 is a major update and reworking of Version 1. It not only provides a few more features, but it completely changes the Navigator menu creation logic. This means that the parameters used for Version 1 will, for the most part, no longer function if Version 2 is used. We apologize for this non-compatibility. Future versions will be backward-compatible. RecapTo create hierarchical menus in a full-window page:
To create hierarchical menus in a frameset:
Final WordA big to all who provided questions, suggestions and solutions that led to Version 2. As usual, the full code is repeated on our code pages. |
Produced by Peter Belesis and
All Rights Reserved. Legal Notices.Created: May 22, 1998
Revised: June 11, 1998
URL: https://www.webreference.com/dhtml/column20/hier2Final.html