forked from OpenSouce-LNMIIT/JavaScriptProjects
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
41 lines (32 loc) · 744 Bytes
/
index.html
File metadata and controls
41 lines (32 loc) · 744 Bytes
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Javascript Digital Clock</title>
<!--CSS link-->
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<p id="time"></p>
</div>
<!--JavaScript Start-->
<script>
(function() {
function addZeroBefore(v) {
return +v < 10 ? "0" + +v : v;
}
function showTime() {
var today = new Date();
var textTime = addZeroBefore(today.getHours()) + " : " + addZeroBefore(today.getMinutes()) + " : " + addZeroBefore(today.getSeconds());
document.getElementById("time").innerHTML = textTime;
setTimeout(function() {
showTime()
}, 1000);
}
showTime();
})();
</script>
<!--JavaScript End-->
</body>
</html>