Help with script load order?

Please note that official support for this menu version has now ceased. There are still plenty of users, though, and the forum is still running. Some of our long-time users may be able to help you out.
Post Reply
astoorian
Beginner
Beginner
Posts: 5
Joined: Sat Apr 05, 2003 4:06 pm

Help with script load order?

Post by astoorian »

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
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

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 :?
John
Oraya
Beginner
Beginner
Posts: 9
Joined: Tue Apr 01, 2003 10:11 pm

Re: Help with script load order?

Post by Oraya »

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
astoorian
Beginner
Beginner
Posts: 5
Joined: Sat Apr 05, 2003 4:06 pm

Post by astoorian »

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

Gregg
Post Reply