forked from lingonsaft/hacktoberfest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Simple Digital clock.html
55 lines (48 loc) · 948 Bytes
/
Simple Digital 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
43
44
45
46
47
48
49
50
51
52
53
54
55
<!DOCTYPE html>
<html>
<style>
#bgm{
background-color:red;
}
#Time{
text-align:center;
font-family:sans-serif;
color:black;
letter-spacing:3px;
font-size:90px;
text-shadow:8px 5px 30px grey;
position: absolute;
width: 100px;
height: 50px;
top: 50%;
left: 40%;
margin-left: -50px;
margin-top: -25px;
}
</style>
<script>
window.onload = function(){
printTime();
};
function printTime() {
var d = new Date();
var hours = d.getHours();
var mins = d.getMinutes();
var secs = d.getSeconds();
if(hours<10){
hours = "0" + hours;
}
if(mins<10){
mins = "0" + mins;
}
if(secs<10){
secs = "0" + secs;
}
document.getElementById("Time").innerHTML = hours+":"+mins+":"+secs;
}
setInterval(printTime, 1000);
</script>
<body id = "bgm">
<div id = "Time"></div>
</body>
</html>