Javascript examples for Browser Object Model:Window setTimeout
Exit an instance of a timeout function
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*w w w .ja va 2 s . c o m*/ function work() { out.value = new Date() } var interval = setInterval(work, 1000) stopper.onclick = function() { clearInterval(interval) } } </script> </head> <body> <input id="out"> <button id="stopper">stop</button> </body> </html>