Skip to content

Commit 8382bab

Browse files
committed
Add Timer
1 parent edea763 commit 8382bab

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

users/control/script.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,19 @@ function tab(clicked_id) {
5151
document.getElementById("tab1").style.textDecoration = "none";
5252
}
5353
z.style.textDecoration = "underline";
54+
}
55+
function startTime() {
56+
const today = new Date();
57+
let h = today.getHours();
58+
let m = today.getMinutes();
59+
let s = today.getSeconds();
60+
m = checkTime(m);
61+
s = checkTime(s);
62+
document.getElementById('clock').innerHTML = h + ":" + m;
63+
setTimeout(startTime, 1000);
64+
}
65+
66+
function checkTime(i) {
67+
if (i < 10) {i = "0" + i}; // add zero in front of numbers < 10
68+
return i;
5469
}

0 commit comments

Comments
 (0)