Guest User

Untitled

a guest
Oct 22nd, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1.  
  2. <script language="javascript">
  3.  
  4. var LiveClock = new Date();
  5.  
  6.  
  7.  
  8. window.onload = update;
  9.  
  10.  
  11.  
  12. function update(){
  13.  
  14. var hours = LiveClock.getHours();
  15.  
  16. var minutes = LiveClock.getMinutes();
  17.  
  18. var seconds = LiveClock.getSeconds();
  19.  
  20.  
  21.  
  22. if(hours < 10){
  23.  
  24. hours = "0" + hours;
  25.  
  26. }
  27.  
  28.  
  29.  
  30. if(minutes < 10){
  31.  
  32. minutes = "0" + minutes;
  33.  
  34. }
  35.  
  36.  
  37.  
  38. if(seconds < 10){
  39.  
  40. seconds = "0" + seconds;
  41.  
  42. }
  43.  
  44.  
  45.  
  46. document.getElementById("LiveClock").innerHTML = hours + ":" + minutes + ":" + seconds;
  47.  
  48. setTimeout("update()", 1000);
  49.  
  50. }
  51.  
  52.  
  53.  
  54. </script>
  55.  
  56. <div id="LiveClock"></div>
Add Comment
Please, Sign In to add comment