Dr. Dotzauer

warum nehme ich nicht ab quiz

.health-test { max-width: 800px; margin: 0 auto; font-family: -apple-system, BlinkMacSystemFont, “Segoe UI”, Roboto, sans-serif; padding: 20px; } .health-test .card { background: white; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); padding: 20px; margin-bottom: 20px; } .health-test .question { background: #f8f9fa; border-radius: 8px; padding: 15px; margin-bottom: 15px; } .health-test .radio-group { display: flex; flex-direction: column; gap: 10px; } .health-test .radio-option { display: flex; align-items: flex-start; gap: 10px; } .health-test .button { background: #0066cc; color: white; border: none; padding: 10px 20px; border-radius: 4px; cursor: pointer; font-size: 16px; margin: 5px; } .health-test .button:disabled { background: #cccccc; cursor: not-allowed; } .health-test .button.secondary { background: #ffffff; border: 1px solid #0066cc; color: #0066cc; } .health-test .error { background: #ffe6e6; border: 1px solid #ff9999; color: #cc0000; padding: 10px; border-radius: 4px; margin: 10px 0; } .health-test .progress-bar { width: 100%; height: 20px; background: #eee; border-radius: 10px; overflow: hidden; margin: 10px 0; } .health-test .progress-fill { height: 100%; background: #0066cc; transition: width 0.3s ease; } .health-test .result { text-align: center; margin-top: 20px; } .health-test .result-score { font-size: 24px; font-weight: bold; margin: 10px 0; } .health-test .result-interpretation { font-size: 18px; margin: 10px 0; } .health-test h1 { text-align: center; color: #333; font-size: 24px; margin-bottom: 20px; } .health-test .instructions { text-align: center; color: #666; margin-bottom: 20px; } .health-test .warning-highlight { background-color: #fff3f3; border: 2px solid #ffcdd2; }

Gesundheits- und Nachhaltigkeits-Selbsttest

Wähle bei jeder Frage die Option, die am besten auf dich zutrifft.

Bitte beantworte alle Fragen, um dein Ergebnis zu sehen.

Ergebnis berechnen Zurücksetzen

Dein Ergebnis

const questionPairs = [ { warning: “Übergewicht oder ständige Gewichtsschwankungen”, healthy: “Gesundes Gewicht, mit dem man sich wohlfühlt” }, { warning: “Versuche, das Thema aus dem Kopf zu schieben, trotzdem ständig ans Essen denken”, healthy: “Essen entspannt genießen, nicht mehr dran denken bis zur nächsten Mahlzeit” }, { warning: “Müdigkeit und Konzentrationsprobleme”, healthy: “Habe Energie und bin konzentriert” }, { warning: “Motivationstiefs”, healthy: “Motiviert oder automatisiert dir Gutes tun” }, { warning: “Gelenkschmerzen und körperliche Einschränkungen”, healthy: “Volle Beweglichkeit und schmerzfrei” }, { warning: “Stressessen”, healthy: “Bei Stress entspanne ich mich anders (ohne Essen)” }, { warning: “Überessen”, healthy: “Höre auf zu essen, wenn ich satt bin” }, { warning: “Gewicht und Essverhalten schönreden”, healthy: “Klare Sicht und sich sicher fühlen” }, { warning: “Schlafprobleme”, healthy: “Schlaf ist gut” }, { warning: “Erhöhter Bauchumfang”, healthy: “Normaler Bauchumfang” }, { warning: “Problematische Blutwerte”, healthy: “Gesunde Blutwerte” }, { warning: “Chronisches Gefühl, dass es nicht klappt”, healthy: “Zuversicht und fortlaufende Verbesserungen” }, { warning: “Soziale Veranstaltungen meiden oder überessen”, healthy: “Zu sozialen Veranstaltungen gehen und das Essen genießen” }, { warning: “Schuldgefühl und schlechtes Gewissen nach dem Essen”, healthy: “Kein Schuldgefühl oder schlechtes Gewissen nach dem Essen” }, { warning: “Ferngesteuert zum Kühlschrank gehen”, healthy: “Bewusst entscheiden, was ich esse” } ]; document.addEventListener(‘DOMContentLoaded’, function() { const questionsDiv = document.getElementById(‘questions’); const calculateButton = document.getElementById(‘calculate’); const resetButton = document.getElementById(‘reset’); const resultDiv = document.getElementById(‘result’); const progressFill = document.getElementById(‘progress-fill’); const scoreDiv = document.getElementById(‘score’); const interpretationDiv = document.getElementById(‘interpretation’); const errorMessage = document.getElementById(‘error-message’); // Erstelle die Fragen questionPairs.forEach((pair, index) => { const questionDiv = document.createElement(‘div’); questionDiv.className = ‘question’; questionDiv.id = `question-${index}`; questionDiv.innerHTML = `

Frage ${index + 1}
`; questionsDiv.appendChild(questionDiv); }); function calculateScore() { const selections = []; let unansweredQuestions = []; questionPairs.forEach((_, index) => { const radios = document.getElementsByName(`question${index}`); let answered = false; radios.forEach(radio => { if (radio.checked) { selections.push(parseInt(radio.value)); answered = true; } }); if (!answered) { unansweredQuestions.push(index + 1); selections.push(-1); } }); if (unansweredQuestions.length > 0) { errorMessage.textContent = `Bitte beantworte alle Fragen. Noch unbeantwortete Fragen: ${unansweredQuestions.join(’, ’)}`; errorMessage.style.display = ‘block’; resultDiv.style.display = ‘none’; // Hervorheben der unbeantworteten Fragen questionPairs.forEach((_, index) => { const questionDiv = document.getElementById(`question-${index}`); if (unansweredQuestions.includes(index + 1)) { questionDiv.classList.add(‘warning-highlight’); } else { questionDiv.classList.remove(‘warning-highlight’); } }); // Scrolle zur ersten unbeantworteten Frage if (unansweredQuestions.length > 0) { const firstUnanswered = document.getElementById(`question-${unansweredQuestions[0] - 1}`); firstUnanswered.scrollIntoView({ behavior: ‘smooth’, block: ‘center’ }); } return null; } errorMessage.style.display = ‘none’; const healthyCount = selections.filter(s => s === 1).length; const score = Math.max(1, Math.min(10, Math.round((healthyCount / selections.length) * 10))); return score; } function getInterpretation(score) { if (score <= 3) { return “Dein Weg ist nicht nachhaltig. Hier besteht dringender Handlungsbedarf.”; } else if (score <= 6) { return “Du bist auf dem Weg, aber es gibt noch Hindernisse.”; } else { return “Dein Weg ist nachhaltig und gesund!”; } } calculateButton.addEventListener(‘click’, () => { const score = calculateScore(); if (score !== null) { progressFill.style.width = `${score * 10}%`; scoreDiv.textContent = `${score}/10`; interpretationDiv.textContent = getInterpretation(score); resultDiv.style.display = ‘block’; } }); resetButton.addEventListener(‘click’, () => { questionPairs.forEach((_, index) => { const radios = document.getElementsByName(`question${index}`); radios.forEach(radio => { radio.checked = false; }); const questionDiv = document.getElementById(`question-${index}`); questionDiv.classList.remove(‘warning-highlight’); }); resultDiv.style.display = ‘none’; errorMessage.style.display = ‘none’; }); // Entferne Warnung wenn eine Frage beantwortet wird questionsDiv.addEventListener(‘change’, (event) => { if (event.target.type === ‘radio’) { const questionIndex = parseInt(event.target.name.replace(‘question’, ”)); const questionDiv = document.getElementById(`question-${questionIndex}`); questionDiv.classList.remove(‘warning-highlight’); errorMessage.style.display = ‘none’; } }); });