-
Notifications
You must be signed in to change notification settings - Fork 3
/
test1.js
38 lines (37 loc) · 967 Bytes
/
test1.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
//TEST
function loadQuestion(questionIndex){
var ql=questions[questionIndex];
var q.textContent=ql.question;
o1.textContent=ql.option1;
o2.textContent=ql.option2;
o3.textContent=ql.option3;
o4.textContent=ql.option4;
}
function loadNextQuestion(){
var so=document.getElementById("input[type=radio]:checked");
if(!so){
alert("You have to select an answer darling!");
return false;
}
var ans=so.value;
if(ans!==questions[currentIndex].answer){
alert("LOL! Wrong answer");
fpage.style.display="none";
spage.style.display="none";
qpage.style.display="none";
lpage.style.display="block";
}
fpage.style.display="none";
spage.style.display="none";
qpage.style.display="none";
lpage.style.display="none";
wpage.style.display="block";
so.checked=false;
currentIndex++;
alert("Correct!")
if(currentIndex==totq){
surprisepage();
}
loadQuestion(currentIndex);
}
loadQuestion(currentIndex);