[thelist] Waiting for a variable in an SCR script

Peter Small peter at genps.demon.co.uk
Mon Jan 14 06:26:44 CST 2002


ppk wrote:

>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.

This seems a good suggestion. The only thing that worries me is that the
processor will be tied up if I put this in a repeat loop for say ten
cycles. Will the SCR script be processed during the repeat  or in the
timeout periods?

If so, then this would be the ideal solution to my problem.

peter

>>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
>
>
>--
>For unsubscribe and other options, including
>the Tip Harvester and archive of TheList go to:
>http://lists.evolt.org Workers of the Web, evolt !







More information about the thelist mailing list