var ul = document.getElementById('ul')
var nextButton = document.getElementById('btnNext');
var quizbox = document.getElementById('questionBox')
var opt1 = document.getElementById('opt1')
var opt2 = document.getElementById('opt2')
var opt3 = document.getElementById('opt3')
var opt4 = document.getElementById('opt4')
var app={
questions:[
{
q:'What is the name of the river',
options: ['Danube', 'Niger', 'Congo', 'Limpopo'],
answer:1
},
{
q:'What is the name of the Deadly virus',
options: ['Antrax', 'Killvi', 'Corona', 'Wuhanvi'],
answer:2
}
],
index:0,
load:function(){
if(this.index<=this.questions.length-1){
quizbox.innerHTML=this.index+1 + ". " +this.questions[this.index].q;
opt1.innerHTML=this.questions[this.index].options[0];
opt2.innerHTML=this.questions[this.index].options[1];
opt3.innerHTML=this.questions[this.index].options[2];
opt4.innerHTML=this.questions[this.index].options[3];
}
else {
quizbox.innerHTML="Quiz Completed!";
ul.style.display="none";
nextButton.style.display="none";
}
},
next: function(){
this.index++;
this.load();
},
check: function(ele){
var id=ele.id.split('');
if(id[id.length-1]==this.questions[this.index].answer){
this.score++;
ele.className="correct";
this.scoreCard();
}
else{
ele.className="wrong";
}
},
preventClick:function(){
for(let i=0; i
- Home-icon
- PST
- _ENGLISH
- _SINDHI
- _ISLAMIYAT
- _SOCIAL STUDIES/G.K
- _SCIENCE
- _MATHS
- JEST
- _ENGLISH
- _SINDHI
- _ISLAMIYAT
- _SOCIAL STUDIES/G.K
- _SCIENCE
- _MATHS
- NINTH
- _ENGLISH
- _SINDHI
- _ISLAMIYAT
- _BIOLOGY
- _MATH
- _PHYSICS
- _CHEMISTRY
- MATRIC
- _ENGLISH
- _BIOLOGY
- _CHEMISTRY
- _MATH
- _PHYSICS
- XI
- XII
- ENTRY TEST PREP
- MDCAT/ECAT-Chemistry

0 Comments