Code:
<html>
<head>
<title> BodyFat Formula </title>
<script type="text/javascript">
function BodyFat(weight, waist, bodyfat){
var weight = parseInt(document.getElementById("weightBox").value, 10);
var waist = parseInt(document.getElementById("waistBox").value, 10);
var BodyFat = parseInt(document.getElementById("bodyfatBox").value, 10);
weightBox = Math.round(weight * 1.082) + (94.42);
waistBox = Math.round(waist * 4.15);
var str1="Your Body Fat Percentage is ";
document.getElementById('outputDiv').innerHTML= str1.concat(weight);
}
</script>
</head>
<h2>BodyFat Formula</h2>
<p>
Weight: <input type="number" id="weightBox" size="4" value="150" min="0"> pounds
<br>
Waist measurement: <input type="number" id="waistBox" size="4" value="32" min="0"> inches
<br>
BodyFat: <input type="number" id="bodyfatBox" size="4" value="0" min="0" max="0"> percent
<br>
</p>
<input type="button" value="Calculate body fat" onclick="BodyFat();">
<hr>
<div id="outputDiv"></div>
</html>
How is that? Im just confused now it just shows the weight as an answer not the equation?