-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
28 lines (26 loc) · 1.07 KB
/
script.js
File metadata and controls
28 lines (26 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
function clock(){
var today = new Date();
var daytoday = today.getDay();
var h = today.getHours();
var m = today.getMinutes();
var s = today.getSeconds();
var day = h<11 ? 'AM': 'PM';
h = h<10? '0'+h: h;
m = m<10? '0'+m: m;
s = s<10? '0'+s: s;
document.getElementById('hours').innerHTML = h;
document.getElementById('min').innerHTML = m;
document.getElementById('sec').innerHTML = s;
document.getElementById('time').innerHTML = day;
switch(daytoday)
{
case 0 : document.getElementById("sun").style.color="fff"; break;
case 1 : document.getElementById("mon").style.color="fff"; break;
case 2 : document.getElementById("tue").style.color="fff"; break;
case 3 : document.getElementById("wed").style.color="fff"; break;
case 4 : document.getElementById("thu").style.color="fff"; break;
case 5 : document.getElementById("fri").style.color="fff"; break;
case 6 : document.getElementById("sat").style.color="fff";
}
}
var inter = setInterval(clock,400);