fix du quizz
This commit is contained in:
@@ -5,18 +5,27 @@ function test()
|
||||
document.getElementById("demo").innerHTML = "Title!";
|
||||
}
|
||||
var nextquestion;
|
||||
function startQuiz()
|
||||
var nbQuestion;
|
||||
function startQuiz(j)
|
||||
{
|
||||
nextquestion = 1;
|
||||
nbQuestion = j;
|
||||
document.getElementById("test1").style.display = "block";
|
||||
document.getElementById("strt").disabled = "true";
|
||||
}
|
||||
|
||||
function tog()
|
||||
function tog(j)
|
||||
{
|
||||
var chk1 = document.getElementById("tgl1"+nextquestion)
|
||||
var chk2 = document.getElementById("tgl2"+nextquestion)
|
||||
if (chk1.checked==true && chk2.checked != true)
|
||||
|
||||
var chk = [];
|
||||
var test = true
|
||||
for (i=0;i<j;i++)
|
||||
{
|
||||
chk[i] = document.getElementById("tgl"+(i+1)+nextquestion);
|
||||
test = test && String(chk[i].checked) == chk[i].getAttribute("attribut");
|
||||
}
|
||||
|
||||
if (test)
|
||||
{
|
||||
document.getElementById("answer"+nextquestion).innerHTML = "correct";
|
||||
document.getElementById("answer"+nextquestion).style.color = "#00ff00";
|
||||
@@ -30,7 +39,10 @@ function tog()
|
||||
document.getElementById("tgl2"+nextquestion).disabled = "true";
|
||||
document.getElementById("sub1").disabled = "true";
|
||||
nextquestion = nextquestion + 1;
|
||||
if (nextquestion<=nbQuestion)
|
||||
{
|
||||
document.getElementById("test"+nextquestion).style.display = "block";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user