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: Archived Topics for the old Version 3.0 JavaScript Menu
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:33

Help with script load order?


Poster: astoorian
Dated: Saturday April 5 2003 - 16:24:21 BST

I am using a script (pagescroll.js from dhtmlcentral.com) which loads in the <head> section. The scrolling function in this script does not work if it loads before mmenu.js. Is there a way I can get mmenu.js (which is placed after the <body> tag) to load before pagescroll.js, which is in the <head> section?

I am a relative newbie to web design, so I'm not sure what might break by putting either of the scripts into the other section (e.g. putting pagescroll.js into the body section or mmenu.js into the head section)

Here's the relevant code:

<HEAD>
<script language="JavaScript" src="lib/java/n4_reload.js"></script>
<script language="JavaScript" src="lib/java/pagescroll.js"></script>
<script language="JavaScript" src="lib/java/instantlink.js"></script>
</HEAD>

<BODY>
<div id="NavBar" style="position: absolute; left: 0px; top: 0px; width: 800px; height: 20px; z-index: 15">
<script language="JavaScript" src="lib/java/menu_array.js"></script>
<script language="JavaScript" src="lib/java/mmenu.js"></script>
</div>

Any advice?

TIA,
Gregg


Poster: John
Dated: Saturday April 5 2003 - 22:14:14 BST

JS and browsers can be very picky. I have a few situations where the program completely dies if I have the menu loading anywhere on the page. I'm not picking on the menu - Andy plays by the rules. However, when you get 2 or more scripts together all trying to do their thing the end result is usually :x

It is possible to load the menu from the <head>. Some browsers (Opera for one, I think) will not run the menu when called this way. Basically it's just play with it until it [hopefully] works. You're not going to break anything :?

Re: Help with script load order?


Poster: Oraya
Dated: Sunday April 6 2003 - 2:32:35 BST

astoorian wrote:
I am using a script (pagescroll.js from dhtmlcentral.com) which loads in the <head> section. The scrolling function in this script does not work if it loads before mmenu.js. Is there a way I can get mmenu.js (which is placed after the <body> tag) to load before pagescroll.js, which is in the <head> section?

I am a relative newbie to web design, so I'm not sure what might break by putting either of the scripts into the other section (e.g. putting pagescroll.js into the body section or mmenu.js into the head section)

Here's the relevant code:

<HEAD>
<script language="JavaScript" src="lib/java/n4_reload.js"></script>
<script language="JavaScript" src="lib/java/pagescroll.js"></script>
<script language="JavaScript" src="lib/java/instantlink.js"></script>
</HEAD>


<div id="NavBar" style="position: absolute; left: 0px; top: 0px; width: 800px; height: 20px; z-index: 15">
<script language="JavaScript" src="lib/java/menu_array.js"></script>
<script language="JavaScript" src="lib/java/mmenu.js"></script>
</div>

Any advice?

TIA,
Gregg


Have you tried placing it in the body. All it is doing is calling the js file. I find some times if you have a js file called in the head codes it doesn't bother calling the js in the body. Place all in the body and see what happens. Also make sure that your mmenu.js file is the last in the line, for some reason if it is in the middle it will not load the other array files.

Example:


<head>
<title></title>
<meta name="Generator" content="Stones WebWriter 3.5">
<base target="main">
<LINK REL="stylesheet" HREF="style_sheets/page.css" TYPE="text/css">
</head>

<body>

<div id="NavBar" style="position: absolute; left: 0px; top: 0px; width: 800px; height: 20px; z-index: 15">
<script language="JavaScript" src="lib/java/n4_reload.js"></script>
<script language="JavaScript" src="lib/java/pagescroll.js"></script>
<script language="JavaScript" src="lib/java/instantlink.js"></script>
<script language="JavaScript" src="lib/java/menu_array.js"></script>
<script language="JavaScript" src="lib/java/mmenu.js"></script>
<script language="JavaScript" src="mmenu.js" type="text/javascript">
</script>
</body>


Also your NavBar why don't you use a css sheet for posistioning etc?

Hope this helps. Do you have an address that we can look at it?

Oraya[code][/code]


Poster: astoorian
Dated: Wednesday April 9 2003 - 20:02:18 BST

Thanks for the tips! Everything now seems to be working fine!

Gregg