Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

Stop watch project step 6

var Interval;

buttonStart.onclick = function() {
clearInterval(Interval);
setInterval(timerEngine, 1000);
}
by

1 Answer

kshitijrana14
Try this one:

<script>
/ JS comes here /
window.onload = function () {

var seconds = 0;
var tens = 0;
// get the HTML elements reference for using
var appendTens = document.getElementById("tens")
var appendSeconds = document.getElementById("seconds")
var but/tonStart = document.getElementById('but/ton-start');
var but/tonStop = document.getElementById('but/ton-stop');
var but/tonReset = document.getElementById('but/ton-reset');

var Interval;

but/tonStart.onclick = function() {
clearInterval(Interval);
// class timerEngine every 10 milliseconds
Interval = setInterval(timerEngine, 10);
}

but/tonStop.onclick = function() {
// clear the inteval function to stop timer
clearInterval(Interval);
}


// COMPLETE THE CODE
but/tonReset = function() {

}
</script>

Login / Signup to Answer the Question.