...

View Full Version : onmouseout Time delay.



p.davies
05-24-2006, 01:25 PM
Hi,

I am new to javascript and am cobbing together a webpage for my own use.

I have a hidden div for a submenu which is loaded by

<a href="javascript:;" onMouseover="document.getElementById('menunews').style.visibility='visible'" >

I then used

onmouseout="el=this;setTimeout('el.style.visibility=\'hidden\'',1500)"

within the DIV so that it would disapear if hovered over. However, I realised quickly if you don't hover over it, it's stuck there.

So is there a way to modify the <a> link to have the onmouseout within it?

Any and all help would be much appreciated.

P.

vwphillips
05-24-2006, 07:25 PM
something like perhaps

<script>
var Menu,TO;

function ShowMenu(id){
Menu=document.getElementById(id);
Menu.style.visibility='visible';
TO=setTimeout('Menu.style.visibility=\'hidden\';',2000);
}
</script>

<span onmouseover="ShowMenu('MyMenu');">Menu</span>

<div id='MyMenu' style="visibility:hidden;width:200px;height:200px;background-color:red;"
onmouseover="clearTimeout(TO);"
>


</div>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum