[thelist] Javascript Timeouts

Ben Henick persist1 at io.com
Mon Jun 24 16:46:03 CDT 2002

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

My thought is, re-write the code so that the DHTML statement is in its own
function and see what happens.

Setting the timeout onmouseout rather than onmouseover is a great idea,

Ben Henick
Web Author At-Large              Managing Editor
http://www.io.com/persist1/      http://www.digital-web.com/
persist1 at io.com                  bmh at digital-web.com
"Are you pondering what I'm pondering, Pinky?"
"I think so, Brain, but... (snort) no, no, it's too stupid."
"We will disguise ourselves as a cow."
"Oh!" (giggles) "That was it exactly!"

More information about the thelist mailing list