[thelist] Problems with late arrivals of JS SRCs
Simon Dell
simondl at epic.co.uk
Wed Jan 9 07:20:29 CST 2002
in IE 4 and up there is a read-only property of the document object called
"readyState" which holds real time updated info on the loading state of the
page.
it can hold one of the following values:
complete - page finished loading completely
interactive - something to do with being able to interact with some of the
page's loaded objects, but it's not finished loading them all yet
loading - hmmm... ? :)
uninitialized - i guess this is an error code of some sort
if you pole this periodically, you can test whether the page has completely
loaded
use something like..
<body onload="checkLoaded()">
blah...
</body>
then in the first js listed in the header put
var nTimerID;
function checkLoaded()
{
if(document.readyState != "complete")
nTimerID = setTimeout("checkLoaded()", 100); // waits 1/10th of a second
then calls the function again
else
doTheNextThing(); // call whatever needs to be called next
}
or, you could just put all your JS into one file ;-)
i'm sure none of this code will be useful, and you probably want it to work
in Netscape/Mozilla/Opera as well...
good luck
simon
More information about the thelist
mailing list