Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- function startTime() {
- var today=new Date();
- var h=today.getHours();
- var m=today.getMinutes();
- var s=today.getSeconds();
- h = checkTime(h);
- m = checkTime(m);
- s = checkTime(s);
- document.getElementById('clock').innerHTML = h+":"+m;
- var t = setTimeout(function(){startTime()},500);
- }
- function checkTime(i) {
- if (i<10) {i = "0" + i}; // add zero in front of numbers < 10
- return i;
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement