axel22

11-09-2012, 05:58 AM

Im trying to figure out/understand about multiple RETURN functions. But, I cant execute my function.

function SqFeetToSqMeters(sqFeet)

{

var sqMeters;

sqMeters = sqFeet/10.764;

return sqMeters;

}

function PoundsToKilograms(pounds)

{

var kg;

kg = pounds/2.205;

return kg;

}

//

function CentimetersToInches(cm)

{ var inches;

inches = cm / 2.54;

return inches; }

function HEIGHT(surface, weight)

{var surface = 'sqMeter';

var weight = 'kg';

height = Math.pow(surface, 2) * 3600) / weight);

return height;

}

function FINDHEIGHT()

{

var surface, weight, height;

surface= parseFloat(document.getElementById('SBox').value);

weight = parseFloat(document.getElementById('WBox').value);

height= Math.round(HEIGHT(surface,weight));

document.getElementById('HBox').value = height;

var str1='Your Height is ';

document.getElementById('outputDiv').innerHTML= str1.concat(height);

}

</script>

</head>

<body>

<h2>Using the Mosteller formula to calculate the height from the body Surface and Weight</h2>

<p>

surface: <input type="text" id="SBox" size=4 value=19.45> sq ft.<br>

weight: <input type="text" id="WBox" size=4 value=150> pounds<br>

height(calculated): <input type="text" id="HBox" size=4 value=0> inches<br>

<input type="button" value="calculate the height" onclick="FINDHEIGHT();">

</p>

<hr>

<div id="outputDiv"></div>

</body>

</html>

</html>

function SqFeetToSqMeters(sqFeet)

{

var sqMeters;

sqMeters = sqFeet/10.764;

return sqMeters;

}

function PoundsToKilograms(pounds)

{

var kg;

kg = pounds/2.205;

return kg;

}

//

function CentimetersToInches(cm)

{ var inches;

inches = cm / 2.54;

return inches; }

function HEIGHT(surface, weight)

{var surface = 'sqMeter';

var weight = 'kg';

height = Math.pow(surface, 2) * 3600) / weight);

return height;

}

function FINDHEIGHT()

{

var surface, weight, height;

surface= parseFloat(document.getElementById('SBox').value);

weight = parseFloat(document.getElementById('WBox').value);

height= Math.round(HEIGHT(surface,weight));

document.getElementById('HBox').value = height;

var str1='Your Height is ';

document.getElementById('outputDiv').innerHTML= str1.concat(height);

}

</script>

</head>

<body>

<h2>Using the Mosteller formula to calculate the height from the body Surface and Weight</h2>

<p>

surface: <input type="text" id="SBox" size=4 value=19.45> sq ft.<br>

weight: <input type="text" id="WBox" size=4 value=150> pounds<br>

height(calculated): <input type="text" id="HBox" size=4 value=0> inches<br>

<input type="button" value="calculate the height" onclick="FINDHEIGHT();">

</p>

<hr>

<div id="outputDiv"></div>

</body>

</html>

</html>