Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <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> </html>