-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtime.html
More file actions
32 lines (31 loc) · 1.03 KB
/
time.html
File metadata and controls
32 lines (31 loc) · 1.03 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
<!DOCTYPE html>
<html lang="zh-tw">
<head>
<meta charset="UTF-8">
<title>現在時間</title>
<link rel="stylesheet" href="styles/style.css">
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@100..900&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap"
rel="stylesheet">
<style>
p {
font-size: 20vw;
font-family: "Noto Sans TC", sans-serif;
}
</style>
</head>
<body>
<p id="time"></p>
<script>
function updateTime() {
let hours = new Date().getHours();
hours = String((hours % 12) || 12).padStart(2, '0');
const minutes = String(new Date().getMinutes()).padStart(2, '0');
const seconds = String(new Date().getSeconds()).padStart(2, '0');
document.getElementById("time").innerText = `${hours}:${minutes}:${seconds}`;
}
updateTime();
setInterval(updateTime, 200);
</script>
<script type="module" src="scripts/script.js"></script>
</body>
</html>