I've created a menu item called 'Function' that when the mouse goes on it a <div> menu appears. Now i would like to keep the menu open until it looses focus either on the Menu item or on the Div! how can i do this!? any help please
Use onmouseout. You might need to set a timer (using setTimeout) to hide them menu after a short delay, which can be cancelled (using clearTimeout) if the user moves back onto the menu.
Dan
The answers you get are only as good as the information you give!
setTimeout takes two parameters - a string, and an integer. The string is the command to run. The integer is the number of milliseconds to delay before running the command. So this:
Code:
setTimeout('alert(\'Hello World\');', 2500);
Would alert 'Hello World' after 2.5 seconds.
It also returns a parameter - the handle to the "thread". So this:
Code:
var myTimerHandle = setTimeout('alert(\'Hello World\');', 2500);
would return a handle to the alert codee that has not yet been run. You can use the handle to clear the timer, so it does not run, using clearTimeout:
Code:
clearTimeout(myTimerHandle);
Hope this helps,
Dan
The answers you get are only as good as the information you give!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.