setTimeout - does it reset when the mouse is moved?

R

Rob Nicholson

How does setTimeout work? If the user moves the mouse or types some text
into a form, does it reset the timer? Or does it start running when first
triggered and simply timeout after that amount of time?

For example, if the timeout is set to 5 minutes and after 4.5 mins, the user
moves the mouse over the screen, does the timer reset to 5 mins or will it
still timeout after another 30 seconds?

Cheers, Rob.
 
M

Michael Winter

How does setTimeout work? If the user moves the mouse or types some text
into a form, does it reset the timer? Or does it start running when first
triggered and simply timeout after that amount of time?

The latter. It simply executes code - either a string containing
statements or a function reference[1] - after a specified number of
milliseconds[2].

[snip]

Mike


[1] See the FAQ for notes on the using a function reference.

<URL:http://www.jibbering.com/faq/faq_notes/misc.html#mtSetTI>

[2] In reality, the delay is only an approximation. Windows 9x,
for instance, only has a resolution of 55 milliseconds, so
accuracy is far from guaranteed.

<URL:http://www.merlyn.demon.co.uk/js-date0.htm#TaI>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top