-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
82 lines (73 loc) · 2.15 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8" />
<title>Clockworks</title>
<link rel="stylesheet" href="styles.css" />
<link
href="https://fonts.googleapis.com/css?family=Montserrat:200,400,800&display=swap"
rel="stylesheet"
/>
<script>
function startTime() {
var today = new Date();
var h = today.getHours();
var m = today.getMinutes();
var s = today.getSeconds();
m = checkTime(m);
s = checkTime(s);
let text = "Your current time is ➭"
document.getElementById('txt').innerHTML =
text + h + ":" + m + ":" + s;
var t = setTimeout(startTime, 500);
}
function checkTime(i) {
if (i < 10) {i = "0" + i}; // add zero in front of numbers < 10
return i;
}
</script>
</head>
<body onload="startTime()">
<div id="txt"></div>
<h1>Clockworks</h1>
<section id="controls">
<div class="input-group">
<label for="minutes-input">Minutes</label>
<input
type="number"
placeholder="0"
id="minutes-input"
max="300"
min="0"
/>
</div>
<div class="input-group">
<label for="seconds-input">Seconds</label>
<input
type="number"
placeholder="0"
id="seconds-input"
step="5"
max="59"
min="0"
/>
</div>
<button type="button" onclick="startTimer();" id="start-button">
Start
</button>
<button type="button" onclick="stopTimer();" id="stop-button" disabled>
Stop
</button>
<button type="button" onclick="pauseTimer();" id="pause-button" disabled>
Pause
</button>
</section>
<h2><span id="minutes">0</span>: <span id="seconds">00</span></h2>
<script
src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous"
></script>
<script src="./script.js"></script>
</body>
</html>