forked from Michael-Lizzio/SWENGroup-1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtimer.html
More file actions
34 lines (29 loc) · 982 Bytes
/
timer.html
File metadata and controls
34 lines (29 loc) · 982 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>55-Minute Timer</title>
</head>
<body>
<h1>55-Minute Countdown Timer</h1>
<div id="timer">55:00</div>
<button onclick="startTimer()">Start 55-Minute Timer</button>
<script>
function startTimer() {
const display = document.getElementById('timer');
let time = 55 * 60; // 55 minutes in seconds
const interval = setInterval(() => {
const minutes = Math.floor(time / 60);
const seconds = time % 60;
display.textContent = `${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`;
if (time <= 0) {
clearInterval(interval);
alert('Time is up!');
}
time--;
}, 1000);
}
</script>
</body>
</html>