Hiermenus Go Forth, XIII - DHTML Lab | 2
Hiermenus Go Forth, XIII:
Version 4.0.6 - The Complete Script (Full-Window)
General Improvements
As outlined in our previous column, the menu-creation speed in NS4 depends not on the number of layers created, but on the number of layers written-to with text content. In Version 4.0.5 we minimized the number of layers that NS4 needs to write to, by omitting redundant layers and introducing a new author-defined parameter, HM_NSFontOver.
In Version 4.0.6, the NS4 code will create the "item mouseover" layer if HM_NSFontOver is true, but not write to it until the user actually needs it, that is, when the user mouses over the item. Therefore, if HM_NSFontOver is true, the menu-creation time can be reduced significantly, by about 40%. If HM_NSFontOver is false, the layers are not created anyway, so there is no change.
Therefore, with version 4.0.6, authors can improve NS4 initial menu-creation speed (during page load) in the following ways:
What to do How to do it Result Create only the top-level menus. HM_PG_CreateTopOnly = true; (for single page only)
HM_GL_CreateTopOnly = true; (for all pages)You may also set the parameter only for NS4:
HM_PG_CreateTopOnly = document.layers ? true : false; (for single page only)
HM_GL_CreateTopOnly = HM_NS4 ? true : false; (for all pages)All child menus in a menu tree will be created only if needed. That is, if the user mouses over a top-level menu item with a child menu. Omit the font color change from the mouseover behavior. HM_PG_NSFontOver = false; (for single page only)
HM_GL_NSFontOver = false; (for all pages)Since font color change requires an additional layer and consequent hard-disk access when the layer is written to, omitting the font color change results in one less layer per menu item. Write to the mouseover layer only if necessary. HM_PG_NSFontOver = true; (for single page only)
HM_GL_NSFontOver = true; (for all pages)or
omit the HM_xx_NSFontOver parameters, forcing the default value of true.
The font color change in the mouseover behavior is maintained, but the requisite layer is not written to until the user mouses over the item. Therefore, the complete mouseover behavior is available to NS4 users, without additional initial menu-creation time. In all browsers, authors had to manually resolve page onload handler conflicts. That is, if the <BODY onLoad> handler exists or if a script other than HM sets an onload handler for the window, authors would have to combine the handler with the HM onload handler. A suggested method was published in the FAQ, as FAQ #3.
There have been many requests for a transparent handler-handling by HM, so 4.0.6 now checks for a previously defined onload event handler, and executes it after the menus are created.
Note:
HM checks for a previously defined onload event handler during page load, so if you need this feature, the menu <SCRIPT> must be included at the end of your page, or at least after all other scripts have been defined and after the BODY tag.
Problems reported with 4.0.5 and fixed in 4.0.6
In all browsers, if the link text included the word "javascript" in the path or filename, for example, "https://www.javascript.com/", HM would consider it to be a JavaScript expression and attempt to execute it, causing an error.
The error was caused by this line inif (this.linkText.indexOf("javascript")!=-1) eval(this.linkText)
It should read:
if (this.linkText.indexOf("javascript:")!=-1) eval(this.linkText)
If you are a regular reader of these columns, you should be having a deja vu about now. Yes, this exact same problem was fixed in Version 3.07 twenty months ago! The elusive colon remained with us until Version 3.10.3, then I seemed to have lost it in Version 4.0. This time, I'm using SuperGlue!
Thanks to Jeff Wilson for pointing this out.
Outstanding Issues
The major outstanding issue involves the correct evaluation of JS statements used in the declaration of parameters. The page-specific and global parameters accept most JS expressions.
Some expressions, especially those involving foreign characters or font names are still problematic. We will attempt to include the new algorithm we are working on in the next release.
Again, if you don't know what we're talking about, it means you are not having problems, which is a good thing.
On the next page, the sample page included in the download.
Produced by Peter Belesis and
All Rights Reserved. Legal Notices.Created: Mar 22, 2001
Revised: Mar 22, 2001
URL: https://www.webreference.com/dhtml/column49/2.html