Il Quiz Impossibile: Domande a trabocchetto
let correctAnswers = 0;
function checkAnswer(question, correctOption) { var options = document.getElementsByName(question); for (var i = 0; i < options.length; i++) { if (options[i].checked) { if (options[i].value == correctOption) { options[i].parentElement.classList.add('correct'); correctAnswers++; } else { options[i].parentElement.classList.add('incorrect'); document.getElementById(question + '-' + correctOption).classList.add('correct'); } break; } } document.getElementById(question + '-next').style.display = 'inline'; updateScore(); } function showNextQuestion(currentQuestion, nextQuestion) { document.getElementById(currentQuestion).style.display = 'none'; document.getElementById(nextQuestion).style.display = 'block'; } function updateScore() { document.getElementById('score').textContent = `${correctAnswers}/5`; } function restartQuiz() { correctAnswers = 0; var questions = document.getElementsByClassName('quiz-question'); for (var i = 0; i { option.classList.remove('correct', 'incorrect'); });
var inputs = document.querySelectorAll('.quiz-options input'); inputs.forEach(input => { input.checked = false; });
var nextButtons = document.querySelectorAll('.next-button'); nextButtons.forEach(button => { button.style.display = 'none'; });
document.getElementById('quiz-result').style.display = 'none';
updateScore();
}
Il Quiz Impossibile: Domande a trabocchetto
Domanda 1: Se un aereo si schianta al confine tra Italia e Francia, dove seppelliscono i sopravvissuti?