-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathclock.html
42 lines (37 loc) · 814 Bytes
/
clock.html
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<html>
<head>
<title>Clock</title>
<style>
body {
background-color:black;
margin:0px;
padding:0px;
}
#clockDiv {
color:red;
font-size:100px;
text-align:center;
width:100%;
position:absolute;
top:35%;
}
</style>
<script type="text/javascript">
function checkTime(i) {
if (i<10) {
i="0" + i;
}
return i;
}
function clock() {
var now = new Date();
var outStr = now.getFullYear()+'-'+(checkTime(now.getMonth()+1))+'-'+checkTime(now.getDate())+' '+checkTime(now.getHours())+':'+checkTime(now.getMinutes())+':'+checkTime(now.getSeconds());
document.getElementById('clockDiv').innerHTML=outStr;
}
setInterval(clock, 1000);
</script>
</head>
<body onload="clock();">
<strong><div id="clockDiv"></div></strong>
</body>
</html>