[Javascript] setTimeout madness

Christopher Basken chriz at basken.com
Thu May 16 11:29:24 CDT 2002


At 11:24 AM 5/16/2002 -0500, you wrote:
>Christopher,
>
>         I don't think there's a third parameter for setTimeout, and even 
> if there
>were, it looks like you want to pass the parameter to miniHide().  Try this
>(making sure that navDivID is the correct name of the variable, of course):
>
>setTimeout("miniHide('" + navDivID + "')", 3000);
>
>         See, the first param of setTimeout is a string which evaluates to a
>function call, so you have to build the string to include the correct
>variable.  If it's not a string but an integer or object reference, then you
>can remove the single quotes.
>
>Cheers,
>
>Peter

Thanks, I tried that, actually, and got a syntax error.  I finally gave up 
and assigned navDivID to a global and just referenced that inside 
miniHide() without passing any args.  Galls me, but I can't seem to get it 
to work any other way.

Oh, the third setTimeout parameter is listed on Netscape's devedge site 
(http://developer.netscape.com/docs/manuals/js/client/jsref/window.htm#1203758). 
This is likely horribly outdated.  I get the feeling setTimeout was stuck 
in as an afterthought.

Thanks again!




More information about the Javascript mailing list