You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sae_2a_anglais/Project/php/js/quiz.js

26 lines
702 B

var currentQuestion = 0;
var score = 0;
function validateAndNext(correct) {
if (correct) score++;
nextQuestion();
}
function nextQuestion() {
var currentQuestionDiv = document.getElementById("question" + currentQuestion);
currentQuestionDiv.style.display = "none";
currentQuestion++;
if (currentQuestion < len) {
var nextQuestionDiv = document.getElementById("question" + currentQuestion);
nextQuestionDiv.style.display = "block";
}
else alert("Quiz terminé. Votre score est de " + score + "/" + len);
}
window.onload = function () {
var firstQuestionDiv = document.getElementById("question0");
firstQuestionDiv.style.display = "block";
};