Web Hosting Talk







View Full Version : JavaScript Question


David@Digisurge
03-04-2002, 07:41 PM
Hello all,

Do any of you know of a way to make a javascript load first on a web site? On my site I have a JS menubar that always loads up last after my images, text, and tables. I would like to give the script priority.

Any one?

GeorgeC
03-04-2002, 08:39 PM
Just put it in the HEAD of your page.

David@Digisurge
03-04-2002, 11:16 PM
Thanks George I'll try that.

David@Digisurge
03-04-2002, 11:19 PM
I just checked and the script is called within my <HEAD> part of the file. Any one have any other ideas????

GeorgeC
03-05-2002, 06:26 AM
Ok, most likely the script is actually invoked when the page loads, using either:

BODY onload=....

or

window.onload=...

If this is the case, the way to make the script load first becomes tricky, as usually there's a reason why the coder specified that the script be loaded after the page fully loads. In some cases there is no way around this.