Guest User

Untitled

a guest
Dec 11th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. <!DOCTYPE html>
  2. 2
  3. <html>
  4. 3
  5. <head>
  6. 4
  7. <title>clock</title>
  8. 5
  9. <meta name="viewport" content="width=320, initial-scale=1">
  10. 6
  11. <style>
  12. 7
  13. body {
  14. 8
  15. background-color: lightblue;
  16. 9
  17. }
  18. 10
  19. 11
  20. h1 {
  21. 12
  22. color: red;
  23. 13
  24. text-align: center;
  25. 14
  26. }
  27. 15
  28. 16
  29. p {
  30. 17
  31. font-family: verdana;
  32. 18
  33. font-size: 60px;
  34. 19
  35. color: #fffe00
  36. 20
  37. }
  38. 21
  39. </style>
  40. 22
  41. <script>
  42. 23
  43. function startTime() {
  44. 24
  45. var today = new Date();
  46. 25
  47. var h = today.getHours();
  48. 26
  49. var m = today.getMinutes();
  50. 27
  51. var s = today.getSeconds();
  52. 28
  53. m = checkTime(m);
  54. 29
  55. s = checkTime(s);
  56. 30
  57. document.getElementById('txt').innerHTML =
  58. 31
  59. h + ":" + m + ":" + s;
  60. 32
  61. var t = setTimeout(startTime, 500);
  62. 33
  63. }
  64. 34
  65. function checkTime(i) {
  66. 35
  67. if (i < 10) {i = "0" + i};
  68. 36
  69. return i;
  70. 37
  71. }
  72. 38
  73. </script>
  74. 39
  75. </head>
  76. 40
  77. <body onload="startTime()">
  78. 41
  79. <h1>
  80. 42
  81. time is
  82. 43
  83. </h1>
  84. 44
  85. <p id="txt"></p>
  86. 45
  87. </body>
  88. 46
  89. </html>
Add Comment
Please, Sign In to add comment