Add the following lines of code between <head> and </head> tags of your web page.
<script type="text/javascript">
<!--
function bmi()
{
var w = parseFloat(document.frm.txtWeight.value);
var h = parseInt(document.frm.txtHeight.value);
var errors='';
if (document.frm.opHeight.value == "Inch") {h = h * 2.54;}
if (document.frm.opWeight.value == "Lb") {w = w * 0.4536;}
if ((w < 20)||(w > 200)||isNaN(w)){errors+='Enter correct weight.\n';}
if ((h < 100) || (h > 250)||isNaN(h)){errors+='Enter correct height.\n';}
if (errors){
alert('The following error(s) occurred:\n'+errors);
return 0;}
document.getElementById('feedback').innerHTML = 'Your BMI is ' + Math.round(10*((w * 10000 / (h * h))))/10;
}
function resetAll(){
document.getElementById('feedback').innerHTML="";
return true;
}
-->
</script>
Add the following lines of code between <body> and </body> tags where you want to display the BMI calculator.
<form name="frm" id="cal_frm" style="width:300px; margin:10px 10px 20px 10px;" onsubmit="return false"> <table id="cal_data"> <tr> <td style="padding-left:5px;">Height:</td> <td><input class="cal_text" type="text" name="txtHeight" ></td> <td><select class="cal_option" name="opHeight"> <option value="Cm">Cm</option> <option value="Inch">Inch</option> </select></td> </tr> <tr> <td style="padding-left:5px;">Weight:</td> <td><input class="cal_text" type="text" name="txtWeight" ></td> <td><select class="cal_option" name="opWeight"> <option value="Kg">Kg</option> <option value="Lb">Pound</option> </select></td> </tr> <tr> <td colspan="3" id="feedback" style="padding:10px 0 20px 0; border:none; font-weight:600; color:#555555; font-family:tahoma;"></td></tr> <tr> <td colspan="2" style="border:none; padding-bottom:10px;"> <input onclick="bmi()" class="cal_button" type="button" value="Calculate" > <input onclick="resetAll()" type="reset" value="Reset" class="cal_button" ></td></tr> </table></form>
BMI stands for Body Mass Index. It is a number calculated for a person's weight and height. This data is extensively used by the health personalities to measure and compare the body fat of a person. BMI is not a direct measure of body fat. But as statistics are available for normal health people, BMI is good substitution of direct body fat measurement and gives fairly good result for most of the people.
| BMI | Weight Status |
| Below 18.5 | Underweight |
| 18.5 to 24.9 | Normal |
| 25 to 29.9 | Overweight |
| 30.0 or above | Obese |
Though no online method can give you accurate measurement of your body fat, the waist circumference method developed by US Navy gives you much better prediction. Please use our Calorie counter to know your percentage of body fat. It also gives you, your everyday calorie need.