Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Showing a Div...pls Help!

Status
Not open for further replies.

Bernini

Programmer
Oct 26, 2004
98
MT
Hi

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


Thsnka
B
 

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!

 
Thanks Billy! I know i have to use onmouseout! the thing is that if i do it on the menu item and hover on the menu itself it will close!

the settimeout seems intresting...how do i work with it? thanks
 

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!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top