-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
91 lines (84 loc) · 2.66 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
83
84
85
86
87
88
89
90
91
<!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>Quiz App | Home</title>
<link rel="shortcut icon" href="./img/bg-image2.jpg" type="image/x-icon" />
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"
/>
<link rel="stylesheet" href="./css/style.css" />
</head>
<body>
<div class="container">
<header>
<h1>HTML QUIZ</h1>
<h1>PARTICIPANT</h1>
</header>
<main>
<form action="javascript:void()">
<p>
<input
type="text"
required
placeholder="Enter your name"
id="username"
name="username"
/>
</p>
<p>
<input id="submitName" type="button" value="SUBMIT NAME" />
</p>
</form>
<div class="quiz_rules">
<p class="start">
<button
id="start"
class="animate__animated animate__heartBeat animate__infinite"
style="display: none"
>
<a href="./pages/quiz.html">START</a>
</button>
</p>
<div class="rules_heading">
<h1>QUIZ RULES</h1>
</div>
<div class="rules">
<p>1. Earn 5 points for each correct answer.</p>
</div>
<div class="rules">
<p>2. No cheating or use of external resources allowed.</p>
</div>
<div class="rules">
<p>3. Questions cannot be previewed or revisited once answered.</p>
</div>
<div class="rules">
<p>
4. Embrace the challenge, have fun, and enjoy the quiz experience.
</p>
</div>
</div>
</main>
</div>
<script>
// Username saved using the WEB API (localStorage)
let usernameInput = document.getElementById("username");
let submitName = document.getElementById("submitName");
let start = document.getElementById("start");
let greetings = document.getElementById("greetings");
submitName.addEventListener("click", () => {
let username = usernameInput.value;
submitName.style.display = "none";
alert("Your name has been saved!");
start.style.display = "block";
console.log(username);
usernameInput.readOnly = true;
localStorage.setItem("username", username);
});
</script>
<script src="./js/script.js"></script>
</body>
</html>