Originally Posted by
[code
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head><title>BMI Calculator</title>
<script type="text/javascript">
<!-- Hide script from non-script-friendly browsers
function BMI Calculator(bmi)
{
var bmi = w / (h*h);
return bmi;
}
//stop hiding the script-->
</script>
</head>
<body>
<script type="text/javascript">
<!-- Hide script from non-script-friendly browsers
var n;
var a;
var h;
var w;
var bmi;
n = prompt("What is your age? ","");
if (n <= 17)
{
document.write("We are unable to calculate your BMI");
}
else if(n => 18)
{
h = prompt("What is your height in metres?","");
w = prompt("What is your weight in kilograms?","");
bmi = w / (h*h);
if (bmi <= 19)
{
message = "Underweight";
}
else if (bmi >= 20 && bmi <= 25)
{
message = "Acceptable";
}
else if (bmi >= 26 && bmi <=30)
{
message = "Overweight";
}
else if (bmi >= 31)
{
message = "Obese";
}
else
{
message = "Error!";
}
content = ("<html><head><title>Your BMI</title></head><body><h1>BODY MASS INDEX (BMI) CALCULATOR</h1>
<p>Your height= " + h + "<br>Your weight= " + w + "<br>Your BMI= " + bmi + "</p>
<p><h2>what your BMI Indicates</h2><br>" + message + "</p>");
document.write(content);
}
// stop hiding the script-->
</script>
</body>
</html>[/code]
it had simple mistakes , after i correct it , it works with me and my bmi was acceptable :cheesy:
"give only what u willing to receive "