How can you reduce the ‘current’ time in setTimeOut? For example I have a countdown going from 100s, after 40s (so at 60s) I click a button and it instantly reduces to 50s (-10s).
The link in the example below enables after 100 seconds. Basically I’m looking for a way to reduce 10 seconds from the (current position in the) countdown every time a button is pressed.
function enableLink() {
setTimeout('enableAnchor( "anchor0", "mylink.php" )', 100000);
}
If this isn’t possible, is there any language or library (JQuery or AJAX perhaps?) that would allow me to do this?
Don’t use the timer values for any real logic, do it by hand:
jsfiddle demo http://jsfiddle.net/JgzZQ/2/