javascipt timer

by Ranganathan 2012-08-29 21:12:34

How to add a 'pause', 'resume', 'reset' and 'end' functions to the following javascript count-up timer?

var sec = 0;

function pad(val) {
return val > 9 ? val : "0" + val;
}
setInterval(function() {
document.getElementById("seconds").innerHTML = pad(++sec % 60);
document.getElementById("minutes").innerHTML = pad(parseInt(sec / 60, 10));
}, 1000);

1050
like
0
dislike
0
mail
flag

You must LOGIN to add comments