View Full Version : Javascript Loading Issue

09-24-2005, 07:22 PM
Hi codingforms.com,

I hope you're well.

I'm having a javascript problem. My web site has a drop down navigation bar and it's essential that it loads; preferrably first. However, I also have some javascript ads (Google ads, my own ads, and some pop unders). When I add some InVue ads, it stops my navigation bar from loading at all.

Is there any way that I can insert some coding to make my navigation bar resolve first? I don't understand why it resolves last and I obviously can't have it not show up at all.

I've searched the archives for this answer, but I couldn't find it. I found a couple of answers to remotely similar questions and I implemented them, but no luck. Any help will be greatly appreciated.

Have a great day.


09-24-2005, 08:00 PM
My web site has a drop down navigation bar and it's essential that it loads; preferrably first.
Then do not use javascript to power it - unordered list of links does the job just fine. There are plenty users without scripting that will not be able to navigate your site, and your most important visitiors - SE bots - are among them.

09-24-2005, 08:08 PM
Thanks for your reply, Vlady.

So, are you suggesting I just code it in html? Right now, it's a drop down box with numerous links in it.


09-24-2005, 11:19 PM
Please forgive my ignorance, but this seems like an issue that a javascript coder should know quite well. I simply need my navigation bar to load first. Is there a way to make it do that?

Any help or input will be greatly appreciated.


09-25-2005, 12:37 AM
A browser starts downloading files in the order that they are referenced in your page. As different files download at different speeds and the priority given to the different downloads may change from one access to the next it is impossible to predict what files will finish downloading first.

Provided that there is no conflict between variable and function names between different scripts they should work correctly regardless of the order they download in. If there is a conflict then one or both wont work correctly regardless of the order that they are downloaded and the only difference the download order might make is which of them gives the error.

09-25-2005, 01:16 AM
Thanks for your explanation, Stephen.

Does anyone have a suggestion or a solution for me? I'm open to anything.


09-25-2005, 06:33 PM
:: friendly bump ::

09-25-2005, 06:49 PM
you can do something like:

function loadRest() {
document.write(rest of html contents);

<div onload="loadRest();">dropdown navigation bar</div>

09-26-2005, 02:21 AM
Thanks for your suggestion. Can you or someone else dumb it down a little? You mean all of my page should be where it says "html contents"? Will this make my navigation bar load first? It looks like it will make it load last. Please excuse my ignorance and thanks, again.


09-26-2005, 10:18 PM
Will this make my navigation bar load first? It looks like it will make it load last.
Did you get this kind of result when you tested the example?

09-27-2005, 04:16 AM
Well, since I couldn't figure it out or get enough help, I've decided to give up trying to make it load first. What I did do is make it load in a window that slides in from the left.

See here:

Old: http://jcsm.org/Wisdom.htm
New: http://jcsm.org/Wisdom2.htm

Any feedback may be beneficial.


09-27-2005, 01:41 PM
proof of concept
sequencial load based on onload event:

<script language="Javascript">
function loadRest() {
alert('Click OK to continue');
var s = '';
s += '<fieldset style="width:10px;">';
s += '<legend style="border-style:solid; border-width:thin;"> load rest </legend>';
s += '<img src="http://www.google.ca/intl/en_ca/images/logo.gif">';
s += '</fieldset>';
document.getElementById('putHere').innerHTML = s;
<div id="putHere"></div>
<fieldset style="width:10px;">
<legend style="border-style:solid; border-width:thin;"> load first </legend>
<img src="http://us.a1.yimg.com/us.yimg.com/i/ww/beta/y3.gif" onload="loadRest()">

09-27-2005, 02:04 PM
It would be beneficial for both you and your visitors if you familiarized yourself with the following document: http://www.w3.org/TR/WCAG10/
That actually applies to both the OP and the last poster....

... Also, IE is not the only browser that is used to browse the web...

09-27-2005, 03:52 PM
The world does not revolve around a theory. Providing the solution could be beneficial.

10-01-2005, 08:31 AM
So, is it just a crapshoot regarding which javascript code resolves first?

I need my ads to run after my navigation bar loads. Can someone help?