-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtimer.html
More file actions
134 lines (112 loc) · 2.8 KB
/
timer.html
File metadata and controls
134 lines (112 loc) · 2.8 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<!DOCTYPE html>
<html>
<link rel="icon" href="https://cdn-icons-png.flaticon.com/512/7784/7784482.png">
<title>Timer - Utilities - The HTML Project</title>
<body>
<h2>Timer</h2>
<p>Seconds long: <input type="number" id="timeInput" value="10"></p>
<button onclick="startCountdown()">Start</button>
<button onclick="stopCountdown()">Stop(reset)</button>
<p>Countdown: </p>
<table>
<tr>
<th><h1><span id="countdown"></span></h1></th>
<audio id="alarmSound" src="alarm.mp3"></audio>
</table>
</head>
<body>
<script>
var countdown;
function startCountdown() {
// Clear any existing countdown
clearInterval(countdown);
// Get the countdown time from the input field
var count = document.getElementById("timeInput").value;
// Update the countdown every 1 second
countdown = setInterval(function() {
document.getElementById("countdown").innerHTML = count;
count--;
if (count < 0) {
clearInterval(countdown);
document.getElementById("countdown").innerHTML = "Time's up!";
// Play the alarm sound
document.getElementById("alarmSound").play();
}
}, 1000);
}
function stopCountdown() {
// Clear the countdown
clearInterval(countdown);
}
</script>
<!DOCTYPE html>
<html>
<head>
<title>Minutes to Seconds Conversion</title>
<style>
table {
width: 10%;
border-collapse: collapse;
}
th, td {
border: 1px solid black;
padding: 15px;
text-align: center;
}
</style>
</head>
<body>
<h2>Minutes to Seconds Conversion</h2>
<table>
<tr>
<th>Minutes</th>
<th>Seconds</th>
</tr>
<tr>
<td>1 minute</td>
<td>60 seconds</td>
</tr>
<tr>
<td>5 minutes</td>
<td>300 seconds</td>
</tr>
<tr>
<td>10 minutes</td>
<td>600 seconds</td>
</tr>
<tr>
<td>15 minutes</td>
<td>900 seconds</td>
</tr>
<tr>
<td>20 minutes</td>
<td>1200 seconds</td>
</tr>
<tr>
<td>1 hour</td>
<td>3600 seconds</td>
</tr>
</table>
</body>
</html>
</body>
<head>
<style>
.footer {
position: right;
left: 0;
bottom: 0;
width: 100%;
background-color: grey;
color: white;
text-align: center;
}
</style>
</head>
<body>
<div class="footer">
<p><a href="dashboard.html" style="color: white;">Back to Dashboard</a></p>
<p><a href="/home/index.html">Back to the NEW Dashboard</a></p>
</div>
</body>
</html>