I've got a question over here..
I got a really simple BMI calculator, its not even a calculator but the think about the idea behind it.. I just made a Case but it didn't work. (I know the value's to be healthy or obesitas are wrong, just doing it for the idea!)
Here You can see the code where I got the problem(Line 19 at the case with <=)
<html>
<head>
<title>Test BMI</title>
<style>
label{
display:block;
}
</style>
<script>
function calc(){
var lengte = document.getElementById("length").value;
var gewicht = document.getElementById("gewicht").value;
var bmi = gewicht / (lengte * lengte);
var getal = parseInt(bmi);
document.getElementById('uitkomst').innerHTML += "";
switch (getal){
case <= 17:
document.getElementById('uitkomst').innerHTML = "U are far to light " + gewicht + "kilo!";
break;
case <= 23 :
document.getElementById('uitkomst').innerHTML = "U are in good shape" + gewicht + "kilo!";
break;
default:
document.getElementById('uitkomst').innerHTML = "just a test";
}
document.getElementById('advies').innerHTML = bmi.toFixed(1);
}
</script>
</head>
<body>
<div id="wrapper" style="margin-left:50px;">
<h1>BMI Berekenen</h1>
<label>Lengte CM</label>
<input type="text" id="length"><br/>
<label>Gewicht KG</label>
<input type="text" id="gewicht">
<button id="bereken" onclick="calc()">Bereken je BMI</button>
<div id="uitkomst">
</div>
<div id="advies">
</div>
</div>
</body>
</html>
Can anybody help me out with this little problem I got in my code:)
Thanks in Advance!