Page 1 of 1

Javascript OnMouseOut SetTimer

Posted: Wed Oct 27, 2004 2:42 pm
by dardsemail
I've changed this posting as I think it was far too much code for here... so I'll tackle the questions one at a time in difference posts. I have a javascript menu that appears on a OnMouseOver. I'd like to have it disappear on a OnMouseOut, but give users time to scroll over the accompanying menu that appears. I understand that I can do this with a SetTimeout function. Here's what I have thus far.

Unfortunately, when I do a mouseover on this, no menus appear at all.

Here's the trigger code:

Code: Select all

<a href="javascript://" onMouseOver="menu('aboutus','visible')" onMouseOut="hide_menu('aboutus','hidden')">
Here's the javascript code:

Code: Select all

<script language="JavaScript">
	
	function menu (whichMenu,whatState)&#123;
	if (document.getElementById)
&#123;document.getElementById(whichMenu).style.visibility = whatState;&#125;
	
	else &#123;document&#1111;whichMenu].visibility = whatState;&#125;

	&#125;
	
	function hide_menu (whichMenu,whatState)&#123;
		setTimeout ('menu ('+this.whichMenu+','+this.whatState')', 1);
		&#125;
	</script>
Any help would be greatly appreciated!

Posted: Thu Oct 28, 2004 10:16 pm
by dardsemail
Well, this one is solved.

I changed the hide_menu to the following...

Code: Select all

function hide_menu (whichMenu,whatState)&#123;
		setTimeout ("menu ('"+whichMenu+"','"+whatState+"');", 2000);
		&#125;
Now it just disappears after a few seconds, which is what its meant to do, except that it does it even if you are still scrolling over the sub-menu. Ah, just when one problem is solved, another one appears.