Quiz Financiero body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; max-width: 800px; margin: 0 auto; padding: 20px; background-color: #f5f5f5; } .quiz-container { background-color: white; border-radius: 10px; padding: 20px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); } h1 { color: #333; text-align: center; margin-bottom: 30px; } .question { margin-bottom: 25px; padding: 15px; border-radius: 8px; background-color: #f9f9f9; } .question h3 { margin-top: 0; color: #444; } .options { display: flex; flex-direction: column; gap: 10px; margin-top: 15px; } .option { display: flex; align-items: center; padding: 10px; border-radius: 5px; background-color: #e9e9e9; cursor: pointer; transition: background-color 0.3s; } .option:hover { background-color: #d9d9d9; } .option input { margin-right: 10px; } .option label { cursor: pointer; flex-grow: 1; } .btn { display: block; width: 200px; margin: 30px auto 0; padding: 12px 0; background-color: #4CAF50; color: white; border: none; border-radius: 5px; font-size: 16px; cursor: pointer; transition: background-color 0.3s; } .btn:hover { background-color: #45a049; } .results { display: none; text-align: center; margin-top: 30px; padding: 20px; border-radius: 8px; background-color: #f0f7ff; } .results h2 { color: #2a5885; margin-bottom: 20px; } .results p { font-size: 18px; margin-bottom: 20px; } .result-image { max-width: 100%; height: auto; border-radius: 8px; margin: 20px 0; box-shadow: 0 4px 8px rgba(0,0,0,0.2); } #restart-btn { background-color: #2a5885; } #restart-btn:hover { background-color: #1e3c5a; }

Encuesta Financiera

Conozca su perfil de ahorro ¿Con qué animal se identifica? Responda las siguientes preguntas y sume sus puntos al final para descubrir qué animal representa su estilo de ahorro.

1. ¿Cómo maneja su dinero a fin de mes?

2. ¿Qué hace cuando recibe un ingreso extra (bono, regalo, premio, etc.)?

3. ¿Cómo planifica sus ahorros a futuro?

4. ¿Qué hace si surge un gasto inesperado?

5. ¿Qué hace si surge un gasto inesperado?

¿Qué tipo de ahorrador es?

Resultado
document.addEventListener('DOMContentLoaded', function() { const submitButton = document.getElementById('submit-btn'); const restartButton = document.getElementById('restart-btn'); const quizSection = document.getElementById('quiz'); const resultsSection = document.getElementById('results'); const resultText2 = document.getElementById('result-text2'); const resultText = document.getElementById('result-text'); const resultImage = document.getElementById('result-image'); // Resultados posibles const results = [ { min: 20, max: 25, text2: "Águila (Inversionista) 🦅", text: "Es un ahorrador arriesgado y ambicioso. Busca maximizar sus ingresos mediante inversiones estratégicas. Le interesa aprender sobre el mercado financiero y hacer crecer su dinero.", image: "https://i.gifer.com/WVN.gif", alt: "Águila (Inversionista) 🦅" }, { min: 15, max: 19, text2: "Zorro (Estratega) 🦊", text: "Eres un planificador nato. Tiene un enfoque equilibrado, analiza sus opciones y sigue un plan de ahorro bien estructurado. Busca seguridad, pero también oportunidades de crecimiento.", image: "https://www.gifsanimados.org/data/media/199/zorro-y-zorrillo-imagen-animada-0090.gif", alt: "Zorro (Estratega) 🦊" }, { min: 10, max: 14, text2: "Panda (Conservador) 🐼", text: "Prefieres ahorrar de manera segura y sin tomar riesgos. Guarda su dinero en cuentas confiables y evita inversiones volátiles. Se siente cómodo con la estabilidad financiera.", image: "https://i.gifer.com/42kt.gif", alt: "Panda (Conservador) 🐼" }, { min: 6, max: 9, text2: "Elefante (Previsor) 🐘", text: "Ahorro lento pero seguro. Se enfoca en la constancia y la disciplina, aunque sin una estrategia de inversión clara. Sabe que el ahorro es importante, pero podría mejorar su planificación.", image: "https://media.tenor.com/sdX5f6-Qr6QAAAAM/party-dancing-elephant.gif", alt: "Elefante (Previsor) 🐘" }, { min: 1, max: 5, text2: "Mono (Impulsivo) 🐵", text: "Gasta sin mucha planificación y le cuesta mantener un ahorro estable. Necesita mejorar su control financiero y establecer metas claras para evitar problemas económicos en el futuro.", image: "https://i.pinimg.com/originals/42/3b/8e/423b8e07f9fb5e284a5960cc30a98b3f.gif", alt: "Mono (Impulsivo) 🐵" } ]; submitButton.addEventListener('click', function() { // Verificar que todas las preguntas estén respondidas const questions = document.querySelectorAll('.question'); let allAnswered = true; questions.forEach(question => { const name = question.querySelector('input').name; const answered = document.querySelector(`input[name="${name}"]:checked`); if (!answered) { allAnswered = false; question.style.border = '2px solid red'; } else { question.style.border = 'none'; } }); if (!allAnswered) { alert('Por favor responde todas las preguntas'); return; } // Calcular resultado let total = 0; document.querySelectorAll('input:checked').forEach(input => { total += parseInt(input.value); }); // Encontrar el resultado correspondiente let result = results.find(r => total >= r.min && total { input.checked = false; }); document.querySelectorAll('.question').forEach(question => { question.style.border = 'none'; }); quizSection.style.display = 'block'; resultsSection.style.display = 'none'; }); });