Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:35
How do I combine two menu's in one page?
Poster: Olaf Vlak
Dated: Friday August 12 2005 - 9:32:41 BST
Hello,
As a webdesigner I'm currently working on a new website for the company and a couple of days ago I've implemented a nice looking expandable dhtml-menu based on a Milonic menu-template, which you can view here;
http://www.opinieland.nl/test/nws.html
Since altering, adjusting and implementing the menu was pretty easy I decided to use the same template for another smaller expandable menu for the user to select his country or language, which you can view here:
http://www.opinieland.nl/test/test.htm
Because both of the menu's are using the same javascripts combining the two menu's on a single page causes them to interfere with eachother.
You can see the problem here:
http://www.opinieland.nl/test/ow4.html
Simply changing the names of the javascriptpages (menu_src.js, mmenudom.js and mmenuns4.js) doesn't do the trick.
Since I'm not a scripter I need your support to resolve this problem. I'm anxiously waiting for your comments...
Poster: Ruth
Dated: Friday August 12 2005 - 16:32:36 BST
Hi Olaf,
You're making it harder than it is. First, don't rename the files. You only need 1 set of milonic_src.js, mmenudom.js and mmenuns4.js. Then you have two separate data files: menu_data.js and flags_data.js. Each of those files will use the same set of base program files. So the coding on the page would be
Code:
<BODY bgColor=#eaeaea leftMargin=0 topMargin=0 onload=preloadImages();
marginheight="0" marginwidth="0"> <SCRIPT src="milonic_src.js" type=text/javascript></SCRIPT>
<A class=milonic href="http://www.milonic.com/"></A>
<SCRIPT type=text/javascript>
if(ns4)_d.write("<scr"+"ipt type=text/javascript src=mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt type=text/javascript src=mmenudom.js><\/scr"+"ipt>");
</SCRIPT>
<SCRIPT src="menu_data.js" type=text/javascript></SCRIPT>
<SCRIPT src="flags_data.js" type=text/javascript></SCRIPT>
marginheight="0" marginwidth="0"> <SCRIPT src="milonic_src.js" type=text/javascript></SCRIPT>
<A class=milonic href="http://www.milonic.com/"></A>
<SCRIPT type=text/javascript>
if(ns4)_d.write("<scr"+"ipt type=text/javascript src=mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt type=text/javascript src=mmenudom.js><\/scr"+"ipt>");
</SCRIPT>
<SCRIPT src="menu_data.js" type=text/javascript></SCRIPT>
<SCRIPT src="flags_data.js" type=text/javascript></SCRIPT>
using your own paths to the files, of course.
Ruth
Poster: kevin3442
Dated: Saturday August 13 2005 - 7:32:28 BST
Hi Olaf,
Ruth's suggestion works very well, especially if you want to have the additional menu only one some pages, but not on others. I will suggest another approach you might consider.
If you plan to have both main menus on every page, then you could just define both menus in the same menu_data.js file (along with all of their styles and submenus). You can have as many "main" menus in the file as you want. The features that distinguish a main menu from a submenu are: (1) a main menu has alwaysvisible=1 and (2) a main menu is usually positioned independently on the page, rather than taking its position from that of another menu. All you have to do is make sure that the two menus have two different names. Like so:
Code:
with(milonic=new menuname("MainMenu1")){
alwaysvisible=1;
left=10;
top=10;
...
}
with(milonic=new menuname("MainMenu2")){
alwaysvisible=1;
left=10;
top=200;
...
}
alwaysvisible=1;
left=10;
top=10;
...
}
with(milonic=new menuname("MainMenu2")){
alwaysvisible=1;
left=10;
top=200;
...
}
Cheers,
Kevin
Poster: Olaf Vlak
Dated: Wednesday August 17 2005 - 13:55:12 BST
Ruth and Kevin, thanks a lot for the feedback! I didn't expect it to be this simple.
I combined both menu's in one javascript-file and even added another one for the business-button.
Here's the final result;
http://www.opinieland.nl/test/ow4.html