This free javascript calculator is used to calculate the calorie needed by a person. Calorie Calculator also calculates fat,protein, carbohydrate needed per day. This Calorie calculator is for free use.
Features
a) Javascript Calorie calculator shows the calorie burned daily.
b) Calorie calculator gives suggestion about daily needs of fat, protein, carbohydrate.
c) This is a free javascript calculator.
d) Just copy the code into your page and use it.
<!-- Script by hscripts.com -->
<!-- copyright of HIOX INDIA -->
<!-- Free javascripts @ http://www.hscripts.com -->
<script type="text/javascript">
function cc()
{
var cneed;
var fneed;
var crneed;
var pneed;
var aneed;
var fd;
var age=parseInt(document.getElementById("age").value);
var foot=parseInt(document.getElementById("foot").value);
var inch=parseInt(document.getElementById("inch").value);
var cm1=(inch*2.54);
var cm2=(foot*30.48);
var cm=cm1+cm2;
var weight=parseInt(document.getElementById("weight").value);
var loa=document.getElementById("loa").value;
if(document.getElementById("gen").checked)
{
fd=66+(13.7*weight)+(5*cm)-(6.8*age);
}
else
{
fd=655+(9.6*weight)+(1.8*cm)-(4.7*age);
}
switch(loa)
{
case "1":
cneed=fd*1.2;
break;
case "2":
cneed=fd*1.375
break;
case "3":
cneed=fd*1.53;
break;
case "4":
cneed=fd*1.725;
break;
case "5":
cneed=fd*1.9;
break;
}
cneed=Math.floor(cneed);
fneed=Math.floor((cneed*0.25)/9);
pneed=Math.floor((cneed*0.25)/4);
crneed=Math.floor((cneed*0.25)/4);
aneed=Math.floor((cneed*0.25)/7);
document.getElementById("rc").innerHTML=" "+cneed+" per day";
document.getElementById("rf").innerHTML=" "+fneed+" grams per day";
document.getElementById("rp").innerHTML=" "+pneed+" grams per day";
document.getElementById("rh").innerHTML=" "+crneed+" grams per day";
document.getElementById("ra").innerHTML=" "+aneed+" grams per day";
}
function con(num)
{
var hc=parseInt(num.value);
var hi=hc/2.54;
var hf=Math.floor(hi/12);
var ri=Math.round(hi%12);
if(hc>40 && hc<=210)
{
document.getElementById("foot").value=hf;
}
document.getElementById("inch").value=ri;
}
function hcon()
{
var hf=parseInt(document.getElementById("foot").value);
var hi=parseInt(document.getElementById("inch").value);
var hc;
hc=Math.round((hf*30.48)+(hi*2.54));
document.getElementById("cen").value=hc;
}
function cknum(event,num)
{
var kc;
if(window.event)
{
kc=event.keyCode;
}
else
{
kc=event.which;
}
var a=num.value;
if(kc==48)
{
if(a=="")
{
return false;
}
else
{
return true;
}
}
if (kc!=8 && kc!=0)
{
if (kc<49||kc>57)
{
return false;
}
}
}
</script>
<!-- Script by hscripts.com -->
For customization of this script or any script development, contact us at support@hscripts.com
Usage
Just follow the below instructions to have your own Calorie Calculator
a)Copy the HTML code given above, save it with .html extension.
b)Just copy and paste the javascript code given above in <head> section of HTML.
c)Run the file in any web browser, to have your own Calorie calculator.
License
- The javascript (misspelled as java script) is given under GPL License
- i.e. Free use for those who use the codes as it is.
- Free, if your modification does not remove our copyright information and links.
- Click Here for detailed license information.
- You can purchase the script if your requirements does not meet our GPL License terms.