Merge branch 'yann' into yoyo

This commit is contained in:
Yoan Guerin
2025-12-05 05:09:17 +01:00
3 changed files with 13 additions and 0 deletions

View File

@@ -69,3 +69,7 @@ button:active {
font-size: 20px; font-size: 20px;
} }
#finalScore {
display: none;
}

View File

@@ -6,12 +6,16 @@ function test()
} }
var nextquestion; var nextquestion;
var nbQuestion; var nbQuestion;
var score
function startQuiz(j) function startQuiz(j)
{ {
nextquestion = 1; nextquestion = 1;
nbQuestion = j; nbQuestion = j;
score = 0;
document.getElementById("test1").style.display = "block"; document.getElementById("test1").style.display = "block";
document.getElementById("test1").scrollIntoView();
document.getElementById("strt").disabled = "true"; document.getElementById("strt").disabled = "true";
document.getElementById("finalScore").style.display = "block";
} }
function tog(j) function tog(j)
@@ -29,6 +33,7 @@ function tog(j)
{ {
document.getElementById("answer"+nextquestion).innerHTML = "correct"; document.getElementById("answer"+nextquestion).innerHTML = "correct";
document.getElementById("answer"+nextquestion).style.color = "#00ff00"; document.getElementById("answer"+nextquestion).style.color = "#00ff00";
score += 1;
} else } else
{ {
document.getElementById("answer"+nextquestion).innerHTML = "incorrect"; document.getElementById("answer"+nextquestion).innerHTML = "incorrect";
@@ -42,6 +47,9 @@ function tog(j)
if (nextquestion<=nbQuestion) if (nextquestion<=nbQuestion)
{ {
document.getElementById("test"+nextquestion).style.display = "block"; document.getElementById("test"+nextquestion).style.display = "block";
document.getElementById("test"+nextquestion).scrollIntoView();
} else {
document.getElementById("finalScore").innerHTML = "Your final score is " + score + "/" + nbQuestion + "!";
} }
} }

View File

@@ -12,5 +12,6 @@
<h1 id="txt">page du quiz</h1> <h1 id="txt">page du quiz</h1>
<button id="strt" onclick="startQuiz({{questions.nbQuestion}})">Start Quiz!</button> <button id="strt" onclick="startQuiz({{questions.nbQuestion}})">Start Quiz!</button>
{% include 'question.html' %} {% include 'question.html' %}
<h2 id="finalScore">continue to get your final score...</h2>
</body> </body>
</html> </html>