<html>
<body>
<button onClick="myTimer = setInterval(myCounter, 1000)">Start counter!</button>
<p id="demo">Click on the button above and I will count forever.</p>
<button onClick="clearInterval(myTimer)">Stop counter!</button>
<script>
var c = 0;
function myCounter() {
document.getElementById("demo").innerHTML = ++c;
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/js/tryit.asp?filename=tryjs_timing_stop by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 21 Dec 2022 17:07:17 GMT -->
</html>