topical media & game development

lib-js-math-calculator-volume.htm / htm

```

<!-- TWO STEPS TO INSTALL AREA/VOLUME GENERATOR:

2.  Add the last code into the BODY of your HTML document  -->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document  -->

<SCRIPT LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Original:  Craig Blanchette (Sk8dogg4@aol.com) -->
<!-- Web Site:  http://craiga.topcities.com -->

<!-- Begin
function findarea(){
document.FORM1.codegenerator.value =
'A = PIR^2\r'
}
function findcircum(){
document.FORM1.codegenerator.value =
'C = 2PIR\r'
+'C = PI x 2 x '+radiuscir+' \r'
+'C = PI x '+diameter+' \r'
}
function rectarea(){
side1 = document.FORM1.rect1.value;
side2 = document.FORM1.rect2.value;
document.FORM1.codegenerator.value =
'A = B x H\r'
+'A = '+side1+' x '+side2+' \r'
+'A = '+roundrect
}
function cylarea(){
cylheight = document.FORM1.cylinderheight.value;
roundcyl = Math.round(cylvolume);
document.FORM1.codegenerator.value =
'V = PIR^2H\r'
+'V = PI x '+sqradius+' x H\r'
+'V = PI x '+sqradius+' x '+cylheight+' \r'
+'V = PI x '+cylhr+' \r'
+'V = '+cylvolume+' \r'
+'V = '+roundcyl;
}
function resetval(){
document.FORM1.codegenerator.value = '';
document.FORM1.cylinderheight.value = 'Height of Cylinder';
document.FORM1.rect1.value = 'Base';
document.FORM1.rect2.value = 'Height';
}
//  End -->
</script>

<!-- STEP TWO: Copy this code into the BODY of your HTML document  -->

<BODY>

<div align="center">
<form name="FORM1">
<font face="Arial, Helvetica, Sans Serif" size="3" color="#0000FF"><b>Enter Radius of Circle/Cylinder</b></font><br><input type="text" size="15" name="areainput" onfocus="this.value=''">
<br>
<input type="button" name="findcircumference" onclick="findcircum()" value="Get Circumference">
<input type="button" name="findarea2" onclick="findarea()" value="Get Area">
<p>
<font face="Arial, Helvetica, Sans Serif" size="3" color="#0000FF"><b>Enter Height of Cylinder</b></font><br><input type="text" name="cylinderheight" onfocus="this.value=''">
<br><input type="button" name="cylinderarea" value="Get volume of Cylinder" onclick="cylarea()">
<br>(<i>Make sure you entered the radius</i>)
<p>
<font face="Arial, Helvetica, Sans Serif" size="3" color="#0000FF"><b>The calculation and answer is below:</b></font><br>
<textarea name="codegenerator" rows="10" cols="30">
</textarea>
<p>
<font face="Arial, Helvetica, Sans Serif" size="3" color="#0000FF"><b>Enter Measurments for Rectangle Area:</b></font>
<br>
<input type="text" name="rect1" value="Base" onfocus="this.value=''">
<br><input type="text" name="rect2" value="Height" onfocus="this.value=''">
<br><input type="button" name="findcircumference" onclick="rectarea()" value="Get Area">.
<br>
<input type="button" name="reset" value="Reset" onclick="resetval()">
</form>
</div>

<p><center>
<font face="arial, helvetica" size"-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>

<!-- Script Size:  4.15 KB -->
```

(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.