[thelist] Javascript Timeouts

Duncan O'Neill dbaxo at ihug.co.nz
Tue Jun 25 03:57:01 CDT 2002


Joel Konkle-Parker wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Thanks for the ideas, I appreciate them. What do you mean by
> assigning the timing to a variable? What do I do with it after I
> assign it?
>
> - -joeljkp
>
> - ---------------------------------------
> http://www.ballsome.com
>
> - -----Original Message-----
> From: thelist-admin at lists.evolt.org
> [mailto:thelist-admin at lists.evolt.org]On Behalf Of Ben Henick
> Sent: Monday, June 24, 2002 4:10 PM
> To: thelist at lists.evolt.org
> Subject: Re: [thelist] Javascript Timeouts
>
>
> On Mon, 24 Jun 2002, Joel Konkle-Parker wrote:
>
>
>>function hideMenu(menu){
>>  setTimeout("document.getElementById(menu).style.visibility =
>>'hidden'", 2000); }
>>
>>called by the following event handler:
>>
>>onmouseout="hideMenu('yadaYadaYada')"
>>
>>When I try to run this, however, IE gives a "'menu' not defined"
>>error. What's my problem?
>
>
> For one, you are not assigning the setTimeout to a variable:
>
> myTimer = window.setTimeout(...);
>
> Meanwhile, the second reference to menu might be causing some
> difficulties.
>

Joel,

your problem may be that the function 'forgets' the value
of menu between setting the Timeout, and it being called.
Using the *value* of the menu variable instead, as
below, might work.

function hideIt(menu){

  menu_timer = setTimeout("document.getElementById(\"" + menu +
"\").style.visibility=hidden;",2000)

}

hth
=====================================================
Duncan O'Neill
=====================================================




More information about the thelist mailing list