View Full Version : how to add a time delay to a onmouseover tag

06-13-2003, 02:14 PM

the site i'm working on has a dhtml navigation. the menus
open/close on mouseover an image:

<a href="javascritp://">
<img src="image.gif"

but sometimes users just want to move their mouse to some-
thing else above and don't want the menus to open. i'd like
to add a time delay function to be shure, that the user wants
to see the menu - let's say after 1/2 sec. over the image the
menu opens... i guess i need something like a settimeout..

but i don't have a clue how this might work.. any ideas??

thank you for your help,


06-13-2003, 05:37 PM
I haven't tested this, but I don't see why it wouldn't work.

<a href="javascript:void(0);">
<img src="image.gif" onmouseover="setTimeout("popUp('menu1', event)", 500);" onmouseout="popDown('menu1');">

BTW, you should begin to get in the habit of typing all tags and attributes in all-lowercase. That is the way of the XHTML future. :D