Fri Nov 09, 2012 3:09 am
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>BMI calculator</title>
<script type="text/javascript">
/* These are the 2 scripts I have made the first one does a whole # between the 2 parameters.
The secound does the first number to the power of the secound */
var random = function(least,most){
return Math.floor(Math.random()*most + least);
};
var power = function(base,exponent){
var loop=1;
var den = 1;
if(exponent===0){
return 1;
}
else if(exponent>0){
for(c=0;c<exponent;c++){
loop=base*loop;
}
return loop;
}
else if(exponent<0){
for(c=0;c<(exponent*-1);c++){
den=base*den;
}
loop=1/den;
return loop;
}
};
var cal2=function(){
var weight=document.getElementById("weight").value;
console.log(weight);
var feet=document.getElementById("feet").value;
console.log(feet)
var inches =document.getElementById("inches").value;
console.log(inches);
var bmi =(weight)/(((feet)*12+(inches))*((feet)*12+(inches)))*703
console.log(bmi)
console.log((100)/((5*12+2)*(5*12+2))*703)
}
</script>
</head>
<body>
<b>Weight</b><br>
<input type="text" value="" id="weight" onFocus="this.select()" size="2"/>Pounds<br>
<b>Height</b><br>
<input type="text" value="" id="feet" onFocus="this.select()" size="2"/>Feet
<input type=text" value="" id="inches" onFocus"this.select()" size="2"/>Inches
<br><input type="button" value="submit" onClick="cal2()"
</body>
</html>
Fri Nov 09, 2012 9:42 pm
Sat Nov 10, 2012 12:05 am
Sat Nov 10, 2012 12:38 pm
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>BMI calculator</title>
<script type="text/javascript">
/* These are the 2 scripts I have made the first one does a whole # between the 2 parameters.
The secound does the first number to the power of the secound */
var random = function(least,most){
return Math.floor(Math.random()*most + least);
};
var power = function(base,exponent){
var loop=1;
var den = 1;
if(exponent===0){
return 1;
}
else if(exponent>0){
for(c=0;c<exponent;c++){
loop=base*loop;
}
return loop;
}
else if(exponent<0){
for(c=0;c<(exponent*-1);c++){
den=base*den;
}
loop=1/den;
return loop;
}
};
var cal2=function(){
var weight=document.getElementById("weight").value;
console.log(weight);
var feet=document.getElementById("feet").value;
console.log(feet)
var inches =document.getElementById("inches").value;
console.log(inches);
var bmi =(weight)/(((feet)*12+(inches))*((feet)*12+(inches)))*703
document.getElementById("outdiv").innerHTML="bmi value equals: "+bmi;
console.log(bmi)
console.log((100)/((5*12+2)*(5*12+2))*703)
}
</script>
</head>
<body>
<b>Weight</b><br>
<input type="text" value="" id="weight" onFocus="this.select()" size="2"/>Pounds<br>
<b>Height</b><br>
<input type="text" value="" id="feet" onFocus="this.select()" size="2"/>Feet
<input type=text" value="" id="inches" onFocus"this.select()" size="2"/>Inches
<br><input type="button" value="submit" onClick="cal2()"/>
<br/><div id="outdiv" />
</body>
</html>
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.