Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var h1 = document.getElementsByTagName('t')[0],
- seconds = 0, minutes = 0, hours = 0,
- t;
- function add() {
- seconds++;
- if (seconds >= 60) {
- seconds = 0;
- minutes++;
- if (minutes >= 60) {
- minutes = 0;
- hours++;
- }
- }
- h1.textContent = (hours ? (hours > 9 ? hours : "0" + hours) : "00") + ":" + (minutes ? (minutes > 9 ? minutes : "0" + minutes) : "00") + ":" + (seconds > 9 ? seconds : "0" + seconds);
- timer();
- }
- function timer() {
- t = setTimeout(add, 1000);
- }
- timer();
- /* We're always watching */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement