Javascript Count Up


SUBMITTED BY: Guest

DATE: June 4, 2013, 7:20 p.m.

FORMAT: JavaScript

SIZE: 807 Bytes

HITS: 1093

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script>
  5. function startTime() {
  6. //Set the start time, Date(Year, Month, Day, Hour, Minute)
  7. var start = new Date(2013, 6, 4, 14, 0); //June 4, 2013 2:00PM
  8. var now = new Date();
  9. var h = now.getHours() - start.getHours();
  10. var m = now.getMinutes() - start.getMinutes();
  11. var s = now.getSeconds() - start.getSeconds();
  12. document.getElementById('txt').innerHTML = "This site has been down for " + h + " Hours, "
  13. + m + " Minutes, and " + s + " Seconds";
  14. t = setTimeout(function () { startTime() }, 500);
  15. }
  16. </script>
  17. </head>
  18. <body onload="startTime()">
  19. <div id="txt"></div>
  20. </body>
  21. </html>

comments powered by Disqus