Domande divertenti (cartoni animati)






Quiz: Domande divertenti (Cartoni Animati)

.quiz-container { max-width: 600px; margin: 40px auto; padding: 20px; border: 2px solid #f39c12; border-radius: 10px; background-color: #fef5e7; color: #333; position: relative; } .quiz-question { margin-bottom: 20px; } .quiz-image { width: 100%; height: auto; margin-bottom: 20px; border-radius: 10px; } .quiz-options { list-style-type: none; padding: 0; } .quiz-options li { margin-bottom: 10px; } .quiz-options label { cursor: pointer; } .quiz-options input[type="radio"] { margin-right: 10px; } .next-button, .result-button { background-color: #e67e22; color: #fff; border: none; padding: 12px 24px; margin-top: 10px; cursor: pointer; border-radius: 5px; font-size: 16px; } .next-button:hover, .result-button:hover { background-color: #d35400; } .feedback { font-weight: bold; margin-top: 10px; } .correct-feedback { color: green; } .incorrect-feedback { color: red; } .quiz-result { display: none; text-align: center; } .quiz-result h2 { font-size: 24px; color: #e67e22; } .quiz-result p { font-size: 18px; color: #555; } .score { position: absolute; bottom: 10px; right: 10px; font-size: 18px; font-weight: bold; color: #e67e22; }

let correctAnswers = 0;

function checkAnswer(question, correctOption) { var options = document.getElementsByName(question); var userAnswer = null; for (var i = 0; i < options.length; i++) { if (options[i].checked) { userAnswer = options[i].value; break; } } if (userAnswer === null) { alert("Per favore, seleziona una risposta."); return; } // Disabilita tutte le opzioni dopo la selezione for (var i = 0; i < options.length; i++) { options[i].disabled = true; } var feedbackElement = document.getElementById(question + '-feedback'); var nextButton = document.getElementById(question + '-next'); if (userAnswer == correctOption) { correctAnswers++; feedbackElement.innerHTML = "Corretto!"; feedbackElement.classList.add('correct-feedback'); } else { var correctText = getCorrectAnswerText(question, correctOption); feedbackElement.innerHTML = `Sbagliato! La risposta corretta è: ${correctText}`; feedbackElement.classList.add('incorrect-feedback'); }

updateScore();

// Mostra il pulsante "Avanti" o "Termina" immediatamente nextButton.style.display = 'inline-block'; }

function getCorrectAnswerText(question, correctOption) { var option = document.querySelector(`input[name=${question}][value="${correctOption}"]`); return option.parentElement.innerText; }

function showNextQuestion(currentQuestionId, nextQuestionId) { document.getElementById(currentQuestionId).style.display = 'none'; if (nextQuestionId === 'quiz-result') { showResult(); } else { document.getElementById(nextQuestionId).style.display = 'block'; } }

function updateScore() { document.getElementById('score').textContent = `${correctAnswers}/5`; }

function showResult() { document.getElementById('quiz-result').style.display = 'block'; document.getElementById('final-score').textContent = `Hai risposto correttamente a ${correctAnswers} su 5 domande!`; document.getElementById('score').style.display = 'none'; }

function restartQuiz() { location.reload(); // Ricarica la pagina }

Quiz: Domande divertenti (Cartoni Animati)

Immagine di cartoni animati

Domanda 1: Come si chiama il fidato amico di Bugs Bunny noto per dire “Che succede, amico?”

0/5