-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclock.html
More file actions
executable file
·61 lines (50 loc) · 1.33 KB
/
clock.html
File metadata and controls
executable file
·61 lines (50 loc) · 1.33 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
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
56
57
58
59
60
61
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JavaScript Clock</title>
<style>
body {
margin: 0px;
background-color: #FFFF00;
background-image: url('fields.jpg');
background-size: cover;
color: #CCFFAA;
}
</style>
<script>
<!--
var lineheightmin = 1.1;
function twoDigits(n) {
var retString = n;
if (n<10) {
retString = "0"+retString;
}
return retString;
}
function update() {
var now = new Date();
hh = twoDigits(now.getHours());
mm = twoDigits(now.getMinutes());
ss = twoDigits(now.getSeconds());
hhmmss = hh+":"+mm+":"+ss;
document.getElementById("timepar").firstChild.data = hhmmss;
/* Set font size and line height */
var width = window.innerWidth;
var height = window.innerHeight;
fs1 = (height/lineheightmin)/16;
fs2 = 0.666 * width/56;
fs = fs1; if (fs2<fs) {fs = fs2;}
document.getElementById("timepar").style.fontSize = fs+"em";
document.getElementById("timepar").style.lineHeight = (height - 2)+"px";
}
// -->
</script>
</head>
<body onload='window.setInterval("update();",200)'>
<p id="timepar" style="text-align: center; margin: 0px; padding: 0px;
font-size: 30px; font-weight: bold;">
JavaScript Time by Philip D Loewen, updated 2024-07-09
</p>
</body>
</html>