[thelist] Waiting for a variable in an SCR script

Peter-Paul Koch gassinaumasis at hotmail.com
Mon Jan 14 05:11:49 CST 2002


>I have a script in the body of an html page that is dependent upon a
>variable that is assigned in an SRC script called from the header.
>
>If the SRC is late in arriving, or gets blocked in some way, the script
>doesn't run because the value is undefined.
>
>How can I code for this contingency?
>
>I can call a function in the body tag using the onLoad event to check for
>"undefined" but then all I can do from this is to call a reload.

I'd set a timeout of, say, half a second after which I'd try again. As long 
as the variable remains undefined the script checks for it each 500 
milliseconds. When it does have a value you execute the onLoad script.

ppk

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com





More information about the thelist mailing list