How do I combine two menu's in one page?

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
Olaf Vlak
Beginner
Beginner
Posts: 2
Joined: Thu Aug 11, 2005 4:43 pm

How do I combine two menu's in one page?

Post by Olaf Vlak »

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...
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

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: Select all

<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="https://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
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

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: Select all

with(milonic=new menuname("MainMenu1")){
alwaysvisible=1;
left=10;
top=10;
...
}

with(milonic=new menuname("MainMenu2")){
alwaysvisible=1;
left=10;
top=200;
...
}
Cheers,

Kevin
Olaf Vlak
Beginner
Beginner
Posts: 2
Joined: Thu Aug 11, 2005 4:43 pm

Post by Olaf Vlak »

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
Post Reply