-
Notifications
You must be signed in to change notification settings - Fork 0
/
quiz.js
55 lines (50 loc) · 1.48 KB
/
quiz.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
const nav = document.getElementById("nav")
const openn = document.getElementById("openn")
const button = document.getElementById("openn")
const title = document.getElementById("title")
const closee = document.getElementById("closee")
openn.onclick=()=>{
if (nav.style.opacity==0)
{
nav.style.opacity="1";
nav.style.width="100vw"
nav.style.display="block"
title.style.display="block";
document.body.style.overflow = "hidden";
document.getElementById("one").style.display="block"
}
}
closee.onclick=()=>{
nav.style.opacity="0"
nav.style.width="0px";
title.style.display = "none"
document.body.style.overflow="visible"
document.getElementById("one").style.display="none"
}
//Evaluating the form
//Send using ?in the url in the end
//Submit button
const submit = document.getElementById("submit")
//Calculated score (default = 0)
var final = 0;
//Evaluating function
submit.onclick = () => {
//Check if checked==true
if (document.getElementById("qa-correct").checked == true) {
final++
}
if (document.getElementById("qb-correct").checked == true) {
final++
}
if (document.getElementById("qc-correct").checked == true) {
final++
}
if (document.getElementById("qd-correct").checked == true) {
final++
}
if (document.getElementById("qe-correct").checked == true) {
final++
}
//redirect
location.href="quiz-result.html?res="+final
}