Hi Guys!
I need help with some javascripting because I am pretty new at it.
I have a slider (scriptaculous) with values that are saved into a database when the slider handle is moved. I need to write a function that only executes (which saves the actual value of the slider) if the slider has not been moved for eg. 10 seconds. My problem is that if I use

setTimeout('function();'10000'')

, it writes into the database everytime the slider is moved, but with a 10 sec. delay. What I need is a function to start waiting, but to reset the countdown if the slider is moved again.
Thx in advance

First you need to associate a variable with the setTimeout() function each time it is called, like this:

t = setTimeout(function(), 10000);

Then you can use the clearTimeout() function to cancel the setTimeout() function, like this:

clearTimeout(t)

Hope this helps.

Steven.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.