Differentiating separator/border colours in main/sub menus

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
Bruce Dalbrack
Beginner
Beginner
Posts: 3
Joined: Wed Nov 23, 2005 9:45 am

Differentiating separator/border colours in main/sub menus

Post by Bruce Dalbrack »

Hello

My menu is here: http://www.brucedalbrack.com I would like #FFFFFF separators/borders on the main menu but #888888 seperators/borders on the sub menus.

My apologies for the elementary nature of the question as I'm a bit thick looike viz HTML. Thanks in advance

Bruce
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

The easiest way is to make another style for the submenus. If the style is the same as the menuStyle except for separator colors then the best method is to use copyOf.

Code: Select all

subStyle=new copyOf(menuStyle); 
subStyle.separatorcolor="#888888 "; 
subStyle.bordercolor="#888888"; 
Place that below the menuStyle after the closing } and before the

Code: Select all

with(milonic=new menuname("Main Menu")){
For more information:

1. you need to put the calls for the menu files the first thing after the body tag before anything else

Code: Select all

<body><SCRIPT language=JavaScript src="milonic_src.js" type=text/javascript></SCRIPT>    
<script   language=JavaScript> 
if(ns4)_d.write("<scr"+"ipt language=JavaScript src=mmenuns4.js><\/scr"+"ipt>");       
  else _d.write("<scr"+"ipt language=JavaScript src=mmenudom.js><\/scr"+"ipt>"); 
</script> 

<SCRIPT language=JavaScript src="menu_data.js" type=text/javascript></SCRIPT> 
2. you need to put the menu in the table using the correct method. You cannot just place the menu_data.js file there and have it work correctly on all browsers.

Table example

It's longer for me to try and write here how to do it, than if you take a look at the above link.

Ruth
Last edited by Ruth on Fri Dec 23, 2005 2:50 am, edited 1 time in total.
shacker
Advanced
Advanced
Posts: 19
Joined: Thu Dec 18, 2003 4:41 am
Location: Berkeley, CA
Contact:

Post by shacker »

Many thanks Ruth. This technique also comes in handy when you need a wide spacing on main horizontal menu, but don't want the vertical submenu items separated likewise.

Code: Select all

subStyle=new copyOf(menuStyle);
subStyle.separatorsize="1";
subStyle.separatorpadding="1";
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Right, and there is also separatorwidth and separatorheight that can be used as long as you specify a separatorsize.

Ruth
Post Reply