Click to See Complete Forum and Search --> : Length of the mouseover-event?


Chrisi
07-30-2003, 04:44 AM
hi ppl!
I just have a simple question:
How do I get out how long the mouseover-event is fired by an specific element? Let's say for example I have a link or whatever and after 500miliseconds - the user being over it - a function is called.
I have no idea how to do that.
thx in advance
Chrisi

Gollum
07-30-2003, 06:15 AM
A common way is to call window.setTimeout in the mouseover event (saving the timeout id) to schedule a function call. If the onmouseout event happens before that, use the timeout to call clearTimeout

Charles
07-30-2003, 06:20 AM
<img src="http://forums.webdeveloper.com/avatar.php?userid=6428&dateline=1052734582" alt="[Gollum]" onmouseover="this.wait = setTimeout('alert(\\'What are you looking at?\\')', 500)" onmouseout="clearTimeout(this.wait)">