Advertisement
Guest User

Untitled

a guest
Sep 16th, 2015
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. <script>
  2. function startTime() {
  3. var today=new Date();
  4. var h=today.getHours();
  5. var m=today.getMinutes();
  6. var s=today.getSeconds();
  7. h = checkTime(h);
  8. m = checkTime(m);
  9. s = checkTime(s);
  10. document.getElementById('clock').innerHTML = h+":"+m;
  11. var t = setTimeout(function(){startTime()},500);
  12. }
  13.  
  14. function checkTime(i) {
  15. if (i<10) {i = "0" + i}; // add zero in front of numbers < 10
  16. return i;
  17. }
  18. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement