This is an Ajax version of US Navy Body fat calculator script. If you are a webmaster and want to add this script on your website you can download this script from here. For mor information please read documentation. If you like to run this script with conventional JavaScript then follow the following instructions.
Add the following lines of code between <head> and </head> tags.
<style type="text/css">
#cal_frm td, #cal_frm input{font-family: Georgia, "MS Serif", "New York", serif;font-size:12px;line-height:150%;}
.cal_text{width:97%;font-size:11px;height:16px;border:none;}
.cal_text:hover{background:#f2f2f2;}
.cal_option{width:100%;font-size:11px;border:none;}
.cal_button{height:20px; border:1px solid gray; background:#dddddd; font-size:11px; font-family:tahoma;}
#feedback input{border:1px solid gray; width:90%;}
table#cal_data{border-collapse:collapse;width:270px;margin:10px 0 0 0;}
#cal_data td{border:solid 1px gray;height:20px;padding:0;width:33%;}
</style>
<script type="text/javascript">
<!--
function Calculate()
{
var ht = parseFloat(document.cal_frm.txtHeight.value);
var nk = parseFloat(document.cal_frm.txtNeck.value);
var wa = parseFloat(document.cal_frm.txtWaist.value);
var hp = parseFloat(document.cal_frm.txtHip.value);
var wt = parseFloat(document.cal_frm.txtWeight.value);
var ag = parseInt(document.cal_frm.txtAge.value);
var sexf=false;
if (document.cal_frm.opGender.value == "1"){sexf=true;}
if (document.cal_frm.opHeight.value == "1") {ht = ht * 2.54;}
if (document.cal_frm.opNeck.value == "1") {nk = nk * 2.54;}
if (document.cal_frm.opWaist.value == "1") {wa = wa * 2.54;}
if (document.cal_frm.opHip.value == "1") {hp = hp * 2.54;}
if (document.cal_frm.opWeight.value == "1") {wt = wt * 0.4536;}
document.getElementById('feedback').innerHTML='';
var errors='';
if ((ht < 122) || (ht > 230) || isNaN(ht)){
err=((document.cal_frm.opHeight.value == "1")? '48inches to 90inches' : '122cm to 230cm');
errors+='Enter height between '+err+'!n';}
if ((nk < 10) || (nk > 100) || isNaN(nk)){
err=((document.cal_frm.opNeck.value == "1")? '6inches to 20inches' : '15cm to 50cm');
errors+='Enter neck between '+err+'!n';}
if ((wa < 20) || (wa > 200) || isNaN(wa)){
err=((document.cal_frm.opWaist.value == "1")? '20inches to 80inches' : '50cm to 150cm');
errors+='Enter waist between '+err+'!n';}
if ((wt < 30) || (wt > 150) || isNaN(wt)){
err=((document.cal_frm.opWeight.value == "1")? '67lb to 333lb' : '30Kg to 150Kg');
errors+='Enter weight between '+err+'!n';}
if ((ag < 19) || (ag > 70) || isNaN(ag)){
err='19yrs to 70yrs';
errors+='Enter age between '+err+'!n';}
if (sexf==true){
if ((hp < 50) || (hp > 200) || isNaN(hp)){
err=((document.cal_frm.opHip.value == "1")? '20inches to 100inches' : '50cm to 250cm');
errors+='Enter hip between '+err+'!n';}}
if(errors){
alert('The following error(s) occurred:n'+errors);
return;}
var fatOw = 18;
var fatOb = 25;
var bstate = true;
var BMR;
var fatpercent;
var w1;
var s1;
var BMI = Math.round((wt * 10000 / (ht * ht))*10)/10;
if (sexf==true) {
fatOw = 25;
fatOb = 31;
BMR = 655 + (9.6 * wt) + (1.8 * ht) - (4.7 * ag);
fatPercent = 495 / (1.29579 - 0.35004 * (logten(wa + hp - nk)) + 0.221 * (logten(ht))) - 450;
}
else{
BMR = 66 + (13.7 * wt) + (5 * ht) - (6.8 * ag);
fatPercent = 495 / (1.0324 - 0.19077 * (logten(wa - nk)) + 0.15456 * (logten(ht))) - 450;
}
BMR=Math.round(BMR*10)/10;
fatPercent = (Math.round(fatPercent*10))/10;
var dailyCal;
if (document.cal_frm.opActivity.value == "0") {dailyCal = BMR * 1.2;}
if (document.cal_frm.opActivity.value == "1") {dailyCal = BMR * 1.375;}
if (document.cal_frm.opActivity.value == "2") {dailyCal = BMR * 1.55;}
if (document.cal_frm.opActivity.value == "3") {dailyCal = BMR * 1.725;}
if (document.cal_frm.opActivity.value == "4") {dailyCal = BMR * 1.9;}
if (BMI < 18){
w1 = (18 * ht * ht / 10000) - wt;
s1 = "You are underweight by ";}
else{
if (fatPercent <= fatOw){
s1 = "Your weight is normal.";
bstate = false;}
else{
w1 = wt * (fatPercent - fatOw) / (100 - fatOw);
if (fatPercent >= fatOb){
s1 = "Your weight state is Obes. You should reduce your weight by ";}
else{
s1 = "You are Overweight by ";}
}
}
if (bstate){
if (document.cal_frm.opWeight.value == 1){
s1 = s1 + (Math.round((w1 / 0.4536)*10)/10) + " pound.";}
else{
s1 = s1 + (Math.round(w1*10)/10) + " Kg.";
}
}
document.getElementById('feedback').innerHTML = "<p>Your BMR is: " + BMR + ";<br />" + "Your BMI is: " + BMI +
";<br />" + "Minimum Calorie requirement is: " + (Math.round(dailyCal)) + ";<br />" + "Your Body Fat is " + fatPercent + "%." + ";<br />" + s1+";</p>";
}
function logten(v){
return (Math.log(v)/Math.log(10));
}
function resetAll(){
document.getElementById('feedback').innerHTML ='';
}
-->
</script>
Add the following codes between <body> and </body> tags at position where you want to appear this calculator.
<form name="cal_frm" id="cal_frm" style="width:400px; margin:20px 10px 20px 10px;" onsubmit="return false"> <table style="width:400px; margin:0px 10px 20px 10px;"> <tr><td style="width: 275px;"> <table id="cal_data"> <tr> <td style="padding-left:5px;">Height:</td> <td><input class="cal_text" type="text" name="txtHeight" size="20" ></td> <td><select class="cal_option" name="opHeight"> <option value="0">Cm</option> <option value="1">Inch</option> </select></td> </tr> <tr> <td style="padding-left:5px;">Neck:</td> <td><input class="cal_text" type="text" name="txtNeck" size="20" ></td> <td><select class="cal_option" name="opNeck"> <option value="0">Cm</option> <option value="1">Inch</option> </select></td> </tr> <tr> <td style="padding-left:5px;">Waist:</td> <td><input class="cal_text" type="text" name="txtWaist" size="20" ></td> <td><select class="cal_option" name="opWaist"> <option value="0">Cm</option> <option value="1">Inch</option> </select></td> </tr> <tr> <td style="padding-left:5px;">Hip (Female):</td> <td><input class="cal_text" type="text" name="txtHip" size="20" ></td> <td><select class="cal_option" name="opHip"> <option value="0">Cm</option> <option value="1">Inch</option> </select></td> </tr> <tr> <td style="padding-left:5px;">Weight:</td> <td><input class="cal_text" type="text" name="txtWeight" size="20" ></td> <td><select class="cal_option" name="opWeight"> <option value="0">Kg</option> <option value="1">Pound</option> </select></td> </tr> </table> </td> <td style="padding: 10px 0 0 10px;"> Gender:<br > <select class="cal_option" style="width:72%;border: solid 1px silver;" name="opGender"> <option value="0">Male</option> <option value="1">Female</option> </select><br ><br > Age:<br > <input class="cal_text" style="width:60%;border: solid 1px silver;" type="text" name="txtAge" size="20" > yrs. </td> </tr> <tr> <td colspan="2" style="padding:10px 0 10px 0;"><span style="padding:0 2px;">Activity:</span> <select id="Select7" class="cal_option" style="width:80%; border:1px solid silver;" name="opActivity"> <option selected="selected" value="0">Sedentary (Very little or no exercise)</option> <option value="1">Lightly active (light exercise/sports 1-3 days/week)</option> <option value="2">Moderately active (moderate exercise/sports 3-5 days/week)</option> <option value="3">Very active (hard exercise/sports 6-7 days a week)</option> <option value="4">Extra active (very hard exercise/sports & physical job or 2x training)</option> </select> </td> </tr> <tr> <td id="feedback" colspan="2" style="padding:0 0 5px 0; font-family:arial; font-size:11px; color:#333333;" ><a style="font-size:1px;color:#ffffff;line-height:1%;" href="http://ramui.com">http://ramui.com</a></td> </tr> <tr> <td colspan="2"> <input onclick="Calculate()" class="cal_button" type="button" value="Calculate" > <input type="reset" class="cal_button" value="Reset" onclick="resetAll()" ></td> </tr></table> </form>
This calorie counter uses Height and Circumference method used by The US Navy to measure percentage of your body fat. It is the simplest and fastest method for estimating your body fat percentage. The U.S. Marine Corps and U.S. Army also rely on this method. In a U.S. Navy study, this method was shown to be as accurate as skinfold testing with calipers, but with a lower standard error of estimation. All that is needed is a measuring tape. After taking the careful and necessary measurements, simple formulas are used to calculate the body fat percentage.
Table-1
| Metric Formula (Cm): | |
| Men | Percentage of Fat = 495 / (1.0324 - 0.19077 x (LOG10(waist - neck)) + 0.15456 x (LOG10(height))) - 450 |
| Women | Percentage of Fat = 495 / (1.29579 - 0.35004 x (LOG10(waist + hip - neck)) + 0.22100 x (LOG10(height))) - 450 |
| English Formula (Inch): | |
| Men | Percentage of Fat = (86.01 x LOG10((waist) - (neck))) - (70.041 x LOG10(height)) + 36.76 |
| Women | Percentage of Fat = (163.205 x LOG10((waist) + (hip) - (neck))) - (97.684 x LOG10(height)) - 78.387 |
Use the table below to estimate your body status.
| Women | Men | Body Status |
| Percentage of body fat: | ||
| 10 to 12 | 2 to 4 | Essential fat |
| 14 to 20 | 6 to 13 | Athletes |
| 21 to 24 | 14 to 17 | Fitness |
| 25 to 31 | 18 to 25 | Acceptable |
| 32% or more | 26% or more | Obese |
The BMR or Basal Metabolic Rate is the calorie your body needs to function when you are in complete rest. Here is how you figure out what your BMR is:
Table-3
| English Formula (Inch and Pound): | |
| Women | BMR = 655 + ( 4.35 x weight ) + ( 4.7 x height ) - ( 4.7 x age in years ) |
| Men | BMR = 66 + ( 6.23 x weight ) + ( 12.7 x height ) - ( 6.8 x age in year ) |
| Metric Formula (Cm and Kg): | |
| Women | BMR = 655 + ( 9.6 x weight ) + ( 1.8 x height ) - ( 4.7 x age in years ) |
| Men | BMR = 66 + ( 13.7 x weight ) + ( 5 x height ) - ( 6.8 x age in years ) |
The daily calorie need is calculated with the help of Harris-Benedict principle. According to this the Basal Metabolic Rate (BMR) is calculated. Now to determine your total daily calorie needs, multiply your BMR by the appropriate activity factor, as follows:
Table-4
| Your Activity Level: | Daily Calorie Need |
| Sedentary (little or no exercise) | BMR x 1.2 |
| Lightly active (light exercise/sports 1-3 days/week) | BMR x 1.375 |
| Moderately active (moderate exercise/sports 3-5 days/week) | BMR x 1.375 |
| Very active (hard exercise/sports 6-7 days a week) | BMR x 1.725 |
| Extra active (very hard exercise/sports & physical job or 2x training) | BMR x 1.9 |
The weight loss calculator calculates how much body fat you have to reduce (if needed) to get a healthy weight. If your percentage of body fat is more than acceptable limit (see table-2) you have to reduce your body fat to avoid some health risk like Diabetics, Type-2 Cancer, Sleep Arena, etc. The rule for good weight loss is slow and steady. A rate 5% to 10% is recommended. The calorie equivalent of body fat is 3500 calorie per pound, i.e. if you want to reduce one pound of your body fat in one week you have to reduce 500 calorie per day from your required daily calorie need and total 7 x 500 = 3500 calorie in a week.
<form name="cal_frm" id="cal_frm" style="width:400px; margin:20px 10px 20px 10px;" onsubmit="return false">Thank you very much.