Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

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:22

Multiple JS files with externam source ..


Poster: proximo
Dated: Friday August 1 2003 - 19:10:56 BST

Hey all, I have a quick question.

I don't know if this can be done but I thought this would be the best place to ask. I have the Milonic menu system and am trying to link one JS file from and external source and the other will be local. The reasoning behind me wanting to do this is my company has internet portal page, now the menu system on the top navigation is global, so its away the same but sometimes we get updates to the menu system on it like adding another link to the menu etc. The problem comes in when we have an update like this it mean all pages with the top nave JS file have to be hunted down and updated. So I wanted to link that JS file from the main page to the site im developing now then have another JS file local that would control the menus for that site specifically.

I have read through the forum and have figured out how to load up two JS files but the problem is that I need to have the menu display property set at the last menu, so its like (1,0,'') and the next one is (2,0,'') and so on. Now my menu on my page would like (7,0,'') and this works fine but when the main JS file is updated with another menu I would have to in turn goto all the pages and change the 7 to 8, is this the only way this can be done ?

I hope this want too confusing :) anyhow hope someone can help


Poster: Hergio
Dated: Monday August 11 2003 - 13:59:32 BST

I think i understand what you're trying to do. You have a top navigation bar thats global and then different sections of the site might have different localized menus, say, on the side of the pages. Well to do that, you just have the global.js file included on every page, and then right below it you include your localized menu file...they should play nice.
Code:
<SCRIPT language=JavaScript src="milonic_src.js" type=text/javascript></SCRIPT>
<SCRIPT language=JavaScript src="global_data.js" type=text/javascript></SCRIPT>
<SCRIPT language=JavaScript src="local_HR_data.js" type=text/javascript></SCRIPT>

What I don't understand is the setting the menu display property. Why do you need to change which one is visible? I guess I dont understand the situation. Could you describe it further and possibly post a URL (I know you said intranet, but do you have a test site?)


Poster: proximo
Dated: Monday August 11 2003 - 15:54:45 BST

Hergio, Ok well let me try and explain a little better, We have the global nav, it get updated sometimes with a new menu item maybe like once every 2 months if you go to http://lacounty.info you can see what I'm talking about the bar at the top with the drop downs is the global.

The situation I'm in now is that the way we currently have the site setup is we use a duplicate JS file for each page, and if the page needs to have more menus in the page then they add to the existing JS file which contains the info for the top nav drop downs as well.

No this method does work but it causes problems when changes for the global nav come down, as Im sure you can imagine it becomes a huge undertaking to keep all these pages updates properly.

Now I was reading a lot of posts about adding 2 JS files etc and I understand the taking out of the first line to allow multiple JS files, but the problem is the numbering I guess. Since it reads the JS files top to bottom if I were to add a global JS file with all the menus in it, then setup my page accordingly calling different JS menus every time a new menu is added to the global JS file it would in turn throw off all corresponding menus because of the adding of a new sub menu etc...

That's really what im trying to figure out, I understand if there is no way around this but if I'm missing something, well that would be great :) because we just keep getting more and more sites and the way its setup just does not seem to be the best way to combat this problem.

Thanks for any information you can provide.


Poster: Hergio
Dated: Monday August 11 2003 - 19:54:51 BST

Ok there is a WAY easier solution to your problem here. You are working too hard to get what you want. Also, you posted in the v5 forum and your menu is v3. I would definetly recommend upgrading to the new and improved version 5. Secondly, you are using version 3.3.X of the old menu, when the most current of the old version is 3.5.X. Upgrade :!:

First of all, you do not need a separate js file for every page on the site. Make one global.js file (keep the important line at the top of the file) and have that contain all your global navigation menus (DO NOT WORRY ABOUT THEIR ORDER).
Then in a separate js file (with the important line at the top removed) declare all your side bar navigation menus, and again, do not worry about order. Now you include both of these files in your page, like so...
Code:
<SCRIPT src='http://lacounty.info/menustuff/globalmenu.js' ></SCRIPT>
<SCRIPT src='http://lacounty.info/menustuff/sidenavmenu.js' ></SCRIPT>
<SCRIPT src='http://lacounty.info/menustuff/mmenu.js' ></SCRIPT>

This will allow you to separately maintain your global menus and your side bar menus, and there will only be ONE copy of each in a menustuff directory so change it there, and it changes everywhere.

Now to your ordering problem. Your global navigation links are text that just has mouseover events attached to them is what I gathered from your code. You'd then call the popup function which would render the menus, and you did it based on the number of the menu. But you dont have to do that, you can render a menu based on its name. To render your first menu, you would have onmouseover=popup("about_site") and that would do it. So if you add more menus down the line, you dont have to change the code in your banners or worry about ordering. If this doesnt work for you, then upgrade to 3.5.X, and you can see it done at http://www.milonic.co.uk/menu/menusample.php?sampleid=2.
One last thing, I see you are using IIS with ASP pages...you should definetly make your banner code a separate .asp page and just <!--#include ... --> it into all your pages if you havent already. It would give you one copy of your banner code, and one copy of your menu code so you only have to maintain in one place.