BMI kalkulačka

Spočítejte si své BMI a zjistěte, jak na tom jste

/* Styly specifické pouze pro BMI kalkulačku */ #bmiCalculatorWidget { /* Widget využije dostupnou šířku rodičovského prvku, nepřidáváme žádný fixní max-width ani margin */ padding: 10px; border: 1px solid #ccc; border-radius: 8px; background-color: #fff; box-sizing: border-box; } #bmiCalculatorWidget h2 { text-align: center; margin-bottom: 15px; } #bmiCalculatorWidget label { display: block; margin-bottom: 5px; font-weight: bold; } #bmiCalculatorWidget input[type=“number“] { width: 100%; padding: 8px; margin-bottom: 10px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; } #bmiCalculatorWidget button { width: 100%; padding: 10px; background-color: #007BFF; color: #fff; border: none; border-radius: 4px; font-size: 16px; cursor: pointer; } #bmiCalculatorWidget button:hover { background-color: #0056b3; } #bmiCalculatorWidget #result { margin-top: 20px; text-align: center; font-size: 18px; } (function() { document.getElementById(‚bmiForm‘).addEventListener(‚submit‘, function(e) { e.preventDefault(); var weight = parseFloat(document.getElementById(‚weight‘).value); var heightCm = parseFloat(document.getElementById(‚height‘).value); if (isNaN(weight) || isNaN(heightCm) || weight <= 0 || heightCm <= 0) { document.getElementById('result').innerText = 'Prosím, zadejte platné hodnoty.'; return; } var heightM = heightCm / 100; var bmi = weight / (heightM * heightM); bmi = bmi.toFixed(2); var interpretation = ''; if (bmi = 18.5 && bmi = 25 && bmi < 29.9) { interpretation = 'Nadváha'; } else { interpretation = 'Obezita'; } document.getElementById('result').innerHTML = 'Vaše BMI je ‚ + bmi + ‚ (‚ + interpretation + ‚).‘; }); })();

Nevyšly vám zrovna ideální hodnoty?

Nevadí, poďte s tím něco udělat ->>