Multiple Menus

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
derekwatts
Beginner
Beginner
Posts: 2
Joined: Fri Jul 16, 2004 1:01 pm
Location: Ontario, Canada
Contact:

Multiple Menus

Post by derekwatts »

I have a menu on each of my pages which works fine.

I now want to have a new additional menu on one of the pages which will be always on whenever that page is viewed.

How do I do that?
User avatar
Maz
Milonic God
Milonic God
Posts: 1717
Joined: Fri Jun 06, 2003 11:39 pm
Location: San Francisco
Contact:

Post by Maz »

Duplicate a menu giving it a new menu name and style if necessary.

Then match the page with an if and else{ statement if necessary.

Around this new menu, or if you wanted it around menu items, place this:

if (location.pathname == "/"){
.......
.......
......
}
else{
......
......
}

This example will feed the if statement only to the index page.

If you don't have an else then leave it off.

Realize that this is being wrapped around existing {...}
So if it ends with a }

It will look like this
}
}

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

Post by Ruth »

Do you want to have an additional as in a different menu in addition to the one that is on there? So you would have two different menus on the page in two different places? If that is what you want, make a new menu_data.js file with all this menu's information in it, name it differently, for example if the menu is going to be on page3.htm you might name it page3_data.js. Then in your calls put in a call for that file also.

Code: Select all

<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>	
<SCRIPT language=JavaScript src="page3_data.js" type=text/javascript></SCRIPT>


Ruth
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

Just wanted to add that with Ruth's suggestion (loading another _data.js file), the new menu and submenus in page3_data.js can still use the styles from your main menu_data.js. There's no need to define the styles again if you want to use the same styles for all of your menus.

Cheers,

Kevin
derekwatts
Beginner
Beginner
Posts: 2
Joined: Fri Jul 16, 2004 1:01 pm
Location: Ontario, Canada
Contact:

Post by derekwatts »

Many thanks for all the help. :D
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Another little thing I forgot to mention. If you make a new data file, make sure you don't name the menus by the same names as in the original data file. They have to be different names so nothing gets confused. I.E. if you had a submenu called links in the first file and also in the second file, which one should the menu program open. I'm not sure how it would decide but it would only open one, I think. Probably the first one it 'reads'.

Ruth
Post Reply