Advertisement
benshepherd

javascript countdown

Feb 14th, 2013
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.37 KB | None | 0 0
  1. <head>
  2. <script>
  3. function startCountdown(x) {
  4.     if(x == 0) {
  5.         document.getElementById("countdown").innerHTML = "take off!!!";
  6.     } else {
  7.         document.getElementById("countdown").innerHTML = "t-minus " + x;
  8.         setTimeout(function() {
  9.             startCountdown(x-1);
  10.         }, 1000);
  11.     }
  12. }
  13. </script>
  14. </head>
  15.  
  16. <body onload="startCountdown(10)">
  17.     <div id="countdown"></div>
  18. </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement