-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
42 lines (41 loc) · 1.2 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>1st_Game</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<header><div id="someDiv" onload="countdown()"></div></header>
<main>
<!--Don't continue reading bc that's cheating ok?! -->
<p>
Clicking the <a href="game_2.html">button </a> brings you to the next
level
</p>
<img src="IMG/Button.png" alt="" width="200px" class="center" />
</main>
<footer>
<button type="button" class="butt">next</button>
</footer>
<script src="script.js"></script>
<script>
let timeleft = 30;
let elem = document.getElementById('someDiv');
let timerId = setInterval(countdown, 1000);
function countdown() {
if (timeleft == -1) {
clearTimeout(timerId);
} else {
elem.innerHTML = timeleft + ' seconds remaining';
timeleft--;
if (timeleft == 0) {
window.location = 'game_2.html';
}
}
}
</script>
</body>
</html>