Posted By

magicrebirth on 11/27/10


Tagged

javascript time setInterval


Versions (?)

Running scripts ciclically


 / Published in: JavaScript
 

URL: http://www.w3schools.com/jsref/met_win_setinterval.asp

  1. <html>
  2. <body>
  3.  
  4. <input type="text" id="clock" />
  5. <script language=javascript>
  6. var int=self.setInterval("clock()",1000);
  7. function clock()
  8. {
  9. var d=new Date();
  10. var t=d.toLocaleTimeString();
  11. document.getElementById("clock").value=t;
  12. }
  13. </script>
  14. </form>
  15. <button onclick="int=window.clearInterval(int)">Stop</button>
  16.  
  17. </body>
  18. </html>

Report this snippet  

You need to login to post a comment.