DHTML Lab: HierMenus CENTRAL: Version 3.x FAQ #10 - dhtmlab.com
Frequently Asked Question #10
Entered: Sept 10, 1999
Most OS menus have separators. That is, horizontal bars that can be used to divide the menu items into logical sections. How can I include separators using the Heirarchical Menus script? |
Menu items can accept HTML to help format the display. See FAQ#4 for an example of this.
We can, therefore, include the <HR> tag, in our array element, creating a separator:
arMenu1_1 = new Array( "3-D Animation","https://www.webreference.com/3d/",0, "Design","https://www.webreference.com/dlab/",0, "<HR SIZE=1>","",0, // "DHTML","https://www.webreference.com/dhtml/",0, "JavaScript","https://www.webreference.com/js/",0 )
If you choose to create a separator in this way, you are including it as a new menu item, albeit a static one. It will have the same rollover behavior as all other items. This may be undesirable.
You can also create a separator in by including it within an item, improving on this behavior:
arMenu1_1 = new Array( "3-D Animation","https://www.webreference.com/3d/",0, "Design<HR SIZE=1>","https://www.webreference.com/dlab/",0, "DHTML","https://www.webreference.com/dhtml/",0, "JavaScript","https://www.webreference.com/js/",0 )
or
arMenu1_1 = new Array( "3-D Animation","https://www.webreference.com/3d/",0, "Design","https://www.webreference.com/dlab/",0, "<HR SIZE=1>DHTML","https://www.webreference.com/dhtml/",0, "JavaScript","https://www.webreference.com/js/",0 )
NOTES:
1
Version 4 allows for items to be excluded from rollover behavior, on an individual basis. Upgrade to the latest HM Version.
2
If you choose to create separators in this way, don't forget that the regular separator parameter variable, that creates separators between all menu items, must be 0, since you are now creating your own separators manually.
separator = 0;
Produced by Peter Belesis and
All Rights Reserved. Legal Notices.
Created: Dec 29, 1998
Revised: June 26, 2001
URL: https://www.webreference.com/dhtml/hiermenus/version3/faq/faq10.html