Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <body> <p>A script on this page starts this clock:</p> <p id="demo"></p> <button onclick="myStopFunction()">Stop time</button> <script> var myVar = setInterval(function(){ myTimer() }, 1000); function myTimer() { var d = new Date(); var t = d.toLocaleTimeString(); document.getElementById("demo").innerHTML = t; } function myStopFunction() { clearInterval(myVar); } </script> </body> <!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_win_clearinterval by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:27:56 GMT --> </html>
Result:
Try it Yourself - © w3schools.com