Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function index() {
- var height;
- var mass;
- var age;
- height = document.BMI_rechner.height.value;
- mass = document.BMI_rechner.mass.value;
- age = document.getElementById('age').value;
- var bmi = (mass / (height * height)) * 10; //Berechnung
- bmi = Math.round(bmi);
- bmi = bmi / 10;
- document.BMI_rechner.output.value = bmi //Ausgabe
- switch(Number(age)) {
- case (19): document.BMI_rechner.ideal.value = "19 und 24";
- break;
- }
- if (bmi < 16) {
- document.BMI_rechner.overweight.style.color = "#ffa600";
- document.BMI_rechner.overweight.value = "Sie haben Untergewicht!"
- } else {
- if (bmi > 25) {
- document.BMI_rechner.overweight.style.color = "#ff0000";
- document.BMI_rechner.overweight.value = "Sie haben Übergewicht!";
- } else {
- document.BMI_rechner.overweight.style.color = "#00ff00";
- document.BMI_rechner.overweight.value = "Sie haben Normalgewicht!";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement