same code 3 places, 1 doesn't work

E

edfialk

Hello, I have a web app up at http://niceguy.wustl.edu/NEISGEI/EmisComp

The relative code I'm talking about is the loading image that is
displayed when a request is made, and disappears when the request is
fulfilled.

Now, I got this code from somewhere, and it works beautifully except
for one spot.

There is a div for each loading image. Here's the code for the first:

function addLoadEvent1(func) {
if (window.onload){
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
}else{
window.onload = function() {
if (oldonload) {
oldonload();
}
func();}
}
}
}

addLoadEvent1(function() {
document.getElementById("loading1").style.display="none";
});


The second and third functions are exactly the same (addLoadEvent2,
getElementById("loading2"), etc.).

Now, the first two loading images correctly disappear when the images
are finished loading, however the third remains....

Also as an interesting sidenote, when I add an alert("test") or
something to the addLoadEvent1() call, right before the
document.getElement..display=none, the alert doesn't pop up. This
section of the code doesn't get read.

Again, the first two work perfectly.

I hope I didn't make this sound too complicated. If anyone has any
questions I'll respond ASAP. Any ideas and I would be greatly
appreciative.

Thanks!
 
E

edfialk

Hey Joe, thanks for the help. I got firebug, which is really nice,
but I can't seem to find any errors anywhere. There is definitely
only one div with id="loading2". There are no javascript errors or
anything that pops up in the console.

I'm totally out of ideas.

Also, I got Simon's code through a middle-man internet page and did
not know the original author. I have added credit to Simon for his
extremely useful code.

Any other ideas?
Thanks!
-Ed
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,586
Members
45,089
Latest member
Ketologenic

Latest Threads

Top