Page 1 of 1

IE 6 & 7 window.onload

Posted: Fri Jan 12, 2007 9:50 pm
by JellyFish
Okay, does IE execute window.onload event before it loads? Cause in firefox my script is working fine but in IE it does not. I think I remember reading that IE's onload event fires when it's loading, not after (like firefox).

Details are appreciated.

Thanks for reading my post.

Posted: Fri Jan 12, 2007 10:08 pm
by Ambush Commander
I don't think so. Are you sure onload's the culprit? (I, personally, always get caught by stray commas in my object definitions. Firefox handles them gracefully but IE barfs).

Posted: Fri Jan 12, 2007 10:21 pm
by nickvd
If I recall correctly, the onload event fires after ALL ELEMENTS on the page have loaded, including external scripts, images, etc... There is a different event handler out on the net that will let you attach your function to it, and it will get fired after the DOM is ready to manipulate.

I can't remember where I saw the code, but I'm using jQuery right now, and it's as simple as:

Code: Select all

$(document).ready(function(){/*take over the world here*/});

Posted: Sat Jan 13, 2007 6:19 am
by Ambush Commander
nickvd, you're right, but that distinction would only make the IE script run slower, not stop it working entirely.