In quale Paese nacque il genere Reggae?






Quiz: In quale Paese nacque il genere Reggae?

.quiz-container { max-width: 600px; margin: 40px auto; padding: 20px; border: 2px solid #27ae60; border-radius: 10px; background-color: #eafaf1; color: #2c3e50; 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: #2ecc71; 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: #27ae60; } .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: #2ecc71; } .quiz-result p { font-size: 18px; color: #555; } .score { position: absolute; bottom: 10px; right: 10px; font-size: 18px; font-weight: bold; color: #2ecc71; } .counter { font-weight: bold; color: blue; }

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';

// Incrementa il contatore degli utenti incrementUserCount(); }

function incrementUserCount() { let userCount = localStorage.getItem('userCount') || 0; userCount++; localStorage.setItem('userCount', userCount); document.getElementById('user-count').textContent = `[${userCount}]`; }

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

document.addEventListener('DOMContentLoaded', function() { let userCount = localStorage.getItem('userCount') || 0; document.getElementById('user-count').textContent = `[${userCount}]`; });

Quiz: In quale Paese nacque il genere Reggae?

Immagine del genere Reggae

Domanda 1: In quale Paese è nato il genere musicale Reggae?

0/5 [0]