-
Notifications
You must be signed in to change notification settings - Fork 2
/
Quiz_game.js
341 lines (238 loc) · 8.49 KB
/
Quiz_game.js
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
//main function to check user answers(Geographic Questions " 1")//
function check() {
var question1 = document.getElementById("quiz").Q1.value;
var question2 = document.getElementById("quiz").Q2.value;
var question3 = document.getElementById("quiz").Q3.value;
var counter = 0;
if (question1 === "Vienne") {
counter++;
}
else { document.getElementById("msg4").innerHTML = "the correct answer is : Vienne";}
if (question2 === "Dublin") {
counter++;
}
else { document.getElementById("msg5").innerHTML = "the correct answer is : Dublin";}
if (question3 === "Katmandou") {
counter++;
}
else { document.getElementById("msg6").innerHTML = "the correct answer is : Katmandou";}
var messages = ["Good job", "Not bad", "You really need to do better"];
var range;
if (counter < 1) {
range = 2;
}
if (counter > 0 && counter < 3) {
range = 1;
}
if (counter > 2) {
range = 0;
document.getElementById("m").innerHTML = "you can test yourself in next level";
document.getElementById("buttonlevel2").className = 'show';
}
document.getElementById("after_click").style.visibility = "visible";
document.getElementById("msg").innerHTML = messages[range];
document.getElementById("correct_answers").innerHTML =
"you got " + counter + " correct.";
}
//reflesh page function//
function myFunction() {
location.reload();
}
//////////////////////sports Questions /////////////
function check_2() {
var question1 = document.getElementById("quiz2").k1.value;
var question2 = document.getElementById("quiz2").k2.value;
var question3 = document.getElementById("quiz2").k3.value;
var counter = 0;
if (question1 === "Soccer") {
counter++;
}
else { document.getElementById("msg7").innerHTML = "the correct answer is : Soccer";}
if (question2 === "Swimming") {
counter++;
}
else { document.getElementById("msg8").innerHTML = "the correct answer is : Swimming";}
if (question3 === "Italy") {
counter++;
}
else { document.getElementById("msg9").innerHTML = "the correct answer is : Italy";}
var messages = ["too smart", "Not bad", "You really need to do better"];
var range;
if (counter < 1) {
range = 2;
}
if (counter > 0 && counter < 3) {
range = 1;
}
if (counter > 2) {
range = 0;
document.getElementById("m").innerHTML = "you can test yourself in next level";
document.getElementById("buttonlevel2").className = 'show';
}
document.getElementById("after_click").style.visibility = "visible";
document.getElementById("msg").innerHTML = messages[range];
document.getElementById("correct_answers").innerHTML =
"you got " + counter + " correct.";
}
//refresh page function//
function myFunction() {
location.reload();
}
///////////////// Music Questions //////////////////
function check_3() {
var question1 = document.getElementById("quiz3").QU1.value;
var question2 = document.getElementById("quiz3").QU2.value;
var question3 = document.getElementById("quiz3").QU3.value;
var counter = 0;
if (question1 === "Curtis James Jackson") {
counter++;
}
else { document.getElementById("msg1").innerHTML = "the correct answer is : Curtis James Jackson";}
if (question2 === "Tones and I") {
counter++;
}
else { document.getElementById("msg2").innerHTML = "the correct answer is : Tones and I ";}
if (question3 === "Tunisia") {
counter++;
}
else { document.getElementById("msg3").innerHTML = "the correct answer is : Tunisia ";}
var messages = ["Good job", "Not bad", "You really need to do better"];
var range;
if (counter < 1) {
range = 2;
}
if (counter > 0 && counter < 3) {
range = 1;
}
if (counter > 2) {
range = 0;
document.getElementById("m").innerHTML = "you can test yourself in next level";
document.getElementById("buttonlevel2").className = 'show';
}
document.getElementById("after_click").style.visibility = "visible";
document.getElementById("msg").innerHTML = messages[range];
document.getElementById("correct_answers").innerHTML =
"you got " + counter + " correct.";
}
///refresh page function////
function myFunction() {
location.reload();
}
//main function to check user answers(Geographic Questions " 2")////////////////////////////////
function checkG0(){
var question1 = document.getElementById("quiz11").Q11.value;
var question2 = document.getElementById("quiz11").Q22.value;
var question3 = document.getElementById("quiz11").Q33.value;
var counter = 0;
if (question1 == "Ireland"){
counter++;
}
else { document.getElementById("msg10").innerHTML = "the correct answer is : Ireland ";}
if (question2 == "New York City") {
counter++;
}
else { document.getElementById("msg11").innerHTML = "the correct answer is :New York City ";}
if (question3 == "Nepal") {
counter++
}
else { document.getElementById("msg12").innerHTML = "the correct answer is :Nepal ";}
var messages = ["Good job", "Not bad", "You really need to do better"];
var range;
if (counter < 1){
range = 2;
}
if (counter > 0 && counter < 3){
range = 1;
}
if (counter > 2){
range = 0;
document.getElementById("m").innerHTML = "you can test yourself in next level";
document.getElementById("buttonlevel2").className = 'show';
}
document.getElementById("after_click").style.visibility="visible";
document.getElementById("msg").innerHTML = messages[range];
document.getElementById("correct_answers").innerHTML = "you got " + counter + " correct.";
}
//reflesh page function//
function myFunction() {
location.reload();
}
//main function to check user answers(Sport Questions " 2")////////////////////////////////
function check_22(){
var question1 = document.getElementById("quiz22").k11.value;
var question2 = document.getElementById("quiz22").k22.value;
var question3 = document.getElementById("quiz22").k33.value;
var counter = 0;
if (question1 == "Chicago Bulls"){
counter++;
}
else { document.getElementById("msg13").innerHTML = "the correct answer is :Chicago Bulls ";}
if (question2 == "9players") {
counter++;
}
else { document.getElementById("msg14").innerHTML = "the correct answer is : 9 players ";}
if (question3 == "Cassius Clay") {
counter++;
}
else { document.getElementById("msg15").innerHTML = "the correct answer is : Cassius Clay ";}
var messages = ["too smart", "Not bad", "You really need to do better"];
var range;
if (counter < 1){
range = 2;
}
if (counter > 0 && counter < 3){
range = 1;
}
if (counter > 2){
range = 0;
document.getElementById("m").innerHTML = "you can test yourself in next level";
document.getElementById("buttonlevel2").className = 'show';
}
document.getElementById("after_click").style.visibility="visible";
document.getElementById("msg").innerHTML = messages[range];
document.getElementById("correct_answers").innerHTML = "you got " + counter + " correct.";
}
//reflesh page function//
function myFunction() {
location.reload();
}
//main function to check user answers(Music Questions " 2")////////////////////////////////
function check_33() {
var question1 = document.getElementById("quiz33").QU11.value;
var question2 = document.getElementById("quiz33").QU22.value;
var question3 = document.getElementById("quiz33").QU33.value;
var counter = 0;
if (question1 === "Eminem") {
counter++;
}
else { document.getElementById("msg16").innerHTML = "the correct answer is : Eminem ";}
if (question2 === " Bruno Mars") {
counter++;
}
else { document.getElementById("msg17").innerHTML = "the correct answer is : Bruno Mars ";}
if (question3 === "Britney Spears") {
counter++;
}
else { document.getElementById("msg18").innerHTML = "the correct answer is : Britney Spears ";}
var messages = ["Good job", "Not bad", "You really need to do better"];
var range;
if (counter < 1) {
range = 2;
}
if (counter > 0 && counter < 3) {
range = 1;
}
if (counter > 2) {
range = 0;
document.getElementById("m").innerHTML = "you can test yourself in next level";
document.getElementById("buttonlevel2").className = 'show';
}
document.getElementById("after_click").style.visibility = "visible";
document.getElementById("msg").innerHTML = messages[range];
document.getElementById("correct_answers").innerHTML =
"you got " + counter + " correct.";
}
///refresh page function////
function myFunction() {
location.reload();
}