Setting a timer in javascript

/ Published in: JavaScript
Save to your folder(s)

Copy this code and paste it in your HTML
  1. //The most common example you'll find
  2. setTimeout("alert('timed out');"},5000);
  4. //The best solution as this gidevs you full flexibility using 'closure'
  5. setTimeout(function()
  6. {
  7. alert("timed out");
  8. },5000);

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.