-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJava2.html
More file actions
42 lines (39 loc) · 1.23 KB
/
Java2.html
File metadata and controls
42 lines (39 loc) · 1.23 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Digital Clock</title>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #222;
color: #0ff;
font-family: 'Arial', sans-serif;
text-align: center;
}
.clock {
font-size: 5em;
font-weight: bold;
text-shadow: 0 0 15px #0ff;
}
</style>
</head>
<body>
<div class="clock" id="digital-clock">00:00:00</div>
<script>
function updateClock() {
const now = new Date();
let hours = now.getHours().toString().padStart(2, '0');
let minutes = now.getMinutes().toString().padStart(2, '0');
let seconds = now.getSeconds().toString().padStart(2, '0');
document.getElementById("digital-clock").textContent = `${hours}:${minutes}:${seconds}`;
}
setInterval(updateClock, 1000);
updateClock(); // Initial call to avoid delay
</script>
</body>
</html>