Simple Stopwatch/Timer/Countdown using HTML+JS
Setting up
- Fork and clone the repository
- open Stopwatch.html in any browser
Contribution
- Follow the instruction in Setting up
- Create issues and wait for it to be reviewed
HTML
<div class="wrapper">
<h2>Stopwatch</h2>
<p><span id="seconds">00</span>
<span id="b">:</span>
<span id="tens">00</span></p>
<button id="button-start">Start</button>
<button id="button-stop">Stop</button>
<button id="button-reset">Reset</button>
</div>
JAVASCRIPT
START
buttonStart.onclick = function() {
clearInterval(Interval);
Interval = setInterval(startTimer, 10);
}
STOP
buttonStop.onclick = function() {
clearInterval(Interval);
}
RESET
buttonReset.onclick = function() {
clearInterval(Interval);
tens = "00";
seconds = "00";
appendTens.innerHTML = tens;
appendSeconds.innerHTML = seconds;
}