-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQuiz.html
167 lines (150 loc) · 4.71 KB
/
Quiz.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
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<html>
<div class="quiz-container">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width"/>
<title>C.I.G Quiz</title>
<link rel="stylesheet" type="text/css" href="CssForQuiz.css"/>
<link rel="icon" type="image/x-icon" href="https://static.thenounproject.com/png/6528691-200.png">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<h1 class="h1center" class="glitch">
<u>Transient Trivia (Multiple Choice Quiz)</u>
</h1>
<i class="fa fa-info-circle" style="font-size:60px"></i>
<hr>
<form id="quiz-form">
<div class="d-flex">
<div class="question">
<p>1. What allows you to make decisions based on conditions?</p>
<div class="answers">
<label>
<input type="radio" name="q1" value="a">
If Else
</label>
<label>
<input type="radio" name="q1" value="b">
Else If
</label>
<label>
<input type="radio" name="q1" value="c">
class=""
</label>
<label>
<input type="radio" name="q1" value="d">
If otherwise
</label>
</div>
</div>
<div class="question">
<p>2. Can you delete the "READ ME" file when making a repository in git hub?</p>
<div class="answers">
<label>
<input type="radio" name="q2" value="a">
If you have enough files to compensate
</label>
<label>
<input type="radio" name="q2" value="b">
No
</label>
<label>
<input type="radio" name="q2" value="c">
Yes
</label>
<label>
<input type="radio" name="q2" value="d">
Only if you make your own
</label>
</div>
</div>
<div class="question">
<p>3. What type of malware replicates itself to spread throughout a network system?</p>
<div class="answers">
<label>
<input type="radio" name="q3" value="a">
Trjoan
</label>
<label>
<input type="radio" name="q3" value="b">
Worms
</label>
<label>
<input type="radio" name="q3" value="c">
Ransomware
</label>
<label>
<input type="radio" name="q3" value="d">
Phishing
</label>
</div>
</div>
<div class="question">
<p>4. What intermediary devices determine and give the best path to reach a particular network?</p>
<div class="answers">
<label>
<input type="radio" name="q4" value="a">
Routers
</label>
<label>
<input type="radio" name="q4" value="b">
Hubs
</label>
<label>
<input type="radio" name="q4" value="c">
Access Point
</label>
<label>
<input type="radio" name="q4" value="d">
Switches
</label>
</div>
</div>
<div class="question">
<p>5. What does the website term, "HTML" stand for?</p>
<div class="answers">
<label>
<input type="radio" name="q5" value="a">
Hyper Tax Makes Line
</label>
<label>
<input type="radio" name="q5" value="b">
Holistick Technical Method Library
</label>
<label>
<input type="radio" name="q5" value="c">
Hyper Text Markup Language
</label>
<label>
<input type="radio" name="q5" value="d">
None of the above
</label>
</div>
</div>
</div>
<button type="submit" class="submit-btn">Submit</button>
</form>
<div class="result" id="result"></div>
<div id="container">
<a href="room.html">
<button class="button">Back to Decorative Room
<i class="fa fa-arrow-right" style=font-size:20px></i>
</button>
</a>
</div>
<script>
const quizForm = document.getElementById('quiz-form');
const resultDiv = document.getElementById('result');
const correctAnswers = ['a', 'c', 'b', 'a', 'c'];
quizForm.addEventListener('submit', e => {
e.preventDefault();
let score = 0;
const userAnswers = [quizForm.q1.value, quizForm.q2.value, quizForm.q3.value, quizForm.q4.value, quizForm.q5.value, ];
userAnswers.forEach((answer, index) => {
if (answer === correctAnswers[index]) {
score += 1;
}
});
resultDiv.innerHTML = `Your score is ${score}/${correctAnswers.length}`;
});
</script>
</html>