Pon a Prueba tu Conocimiento
Puntuación: 0 / 0
`;
quizFeedbackElement.textContent = '';
quizNextBtn.style.display = 'none';
quizRestartBtn.style.display = 'block'; // Mostrar botón de reinicio
quizActive = false; // Desactivar el quiz
}
// Función para reiniciar el quiz
function restartQuiz() {
currentQuestionIndex = 0;
score = 0;
quizActive = true;
quizRestartBtn.style.display = 'none';
loadQuestion();
}
// Event Listeners
quizNextBtn.addEventListener('click', nextQuestion);
quizRestartBtn.addEventListener('click', restartQuiz);
// Debugging logs
console.log("Script 'La Autoestima y la Biblia' cargado.");
// Cargar la primera pregunta al cargar la página
window.onload = function() {
try {
console.log("Window loaded, attempting to load quiz question.");
loadQuestion();
} catch (error) {
console.error("Error al cargar la pregunta del quiz:", error);
// Si hay un error, mostrar un mensaje al usuario en la página.
const quizContainer = document.getElementById('quiz-container');
if (quizContainer) {
quizContainer.innerHTML = '
Hubo un error al cargar el quiz. Por favor, contacta al soporte técnico.
';
}
}
};