[thelist] JavaScript loading *BEFORE* page load?

Jon Hughes hughesj at firemtn.com
Tue Oct 2 14:19:38 CDT 2007


This is bizarre.  Everything I know about JS tells me this isn't
possible, but it's happening.


I have the following simple script:
function WindowLoad() {
	var DeleteLinks = document.getElementsByTagName("div");
	alert(DeleteLinks.length);
}

window.onload = WindowLoad();

When I run this on my page (with it included in an external script
linked from my <head>) it will pop up an alert ("0") and THEN load my
content after I hit "okay"

Shouldn't it be waiting until the page is completely loaded before
initializing that JS?

Thank You,
- Jon Hughes 



More information about the thelist mailing list