jdgrinder
16 Feb 2011, 03:48 PM
I am in the process of adding a calculator page to my company website, so people come to our website instead going to another one to do conversion. I have added the forms etc and got it set up but for some reason it will not calculate. Here is the code.
this is the script for the calculator
<script language="JavaScript">
function calc() {
Pi = 3.1415926535;
a = document.form1.a.value;
b = document.form1.b.value;
c = document.form1.b2.value
d = Pi * (a*a)/4;
e = (b)/231;
f = (d * e);
document.form1.total.value = f;
a2 = document.form1.a.value;
b2 = document.form1.b2.value;
c2 = Pi * (a2*a2)/4;
d2 = Pi * (b2*b2)/4;
e2 = (c2 - d2);
document.form1.total2.value = e2;
f2 = document.form1.total2.value;
g2 = document.form1.b.value;
h2 = (f2 * g2)/231;
document.form1.total222.value = h2
}
//-->
</script>
and here is where one of the calculator is
<table border=2 cellspacing=1 cellpadding=1 width="366" height="319" bordercolorlight="#FF6633" bordercolordark="#CC3333">
<td colspan=3 align=center height="31" bgcolor="0099FF"><font face="Times New Roman, Times, serif" size="3" color="#990033"><b>
<h4>Hydraulic Cylinder Volume Capacity Calculator</b></h4></font> </td>
<tr>
<td height="212" width="117">
<div align="center"><font size="3"><b>Enter Cylinder Bore Diameter
in Inches<br>
<input type="text" name="a" size=15 maxlength="15">
<br>
</b></font> <b><font size="2">Enter Cylinder Rod Diameter in
Inches</font></b><br>
<input type="text" name="b2" size=15 maxlength="15">
<br>
<b><font size="2">Enter Cylinder<br>
Stroke in Inches<br>
</font></b>
<input type="text" name="b" size=15 maxlength="15">
</div>
</td>
<td height="212" width="84">
<div align="center"><br>
<br>
<input type="button" value="Calculate" onClick="calc()" name="Calculate">
<br><br><br>
<input type="reset" value="Reset" name="reset">
</div>
</td>
<td height="212" width="142">
<div align="center"><font size="2"><b>Cylinder Effective Area
<br>
<input type="text" name="total2" size=15 maxlength="15">
<br>
Cylinder Volume Capacity In Gallons Of Fluid</b></font> <b><font size="2">Extended<br>
</font></b><font size="2"> </font>
<input type="text" name="total" size=15 maxlength="15">
<br>
<font size="2"><b>Cylinder Volume Capacity In Gallons Of Fluid</b></font>
<b><font size="2">Retracted <br>
<input type="text" name="total222" size=15 maxlength="15">
</font></b></div>
</td>
Any help is much appreciated
this is the script for the calculator
<script language="JavaScript">
function calc() {
Pi = 3.1415926535;
a = document.form1.a.value;
b = document.form1.b.value;
c = document.form1.b2.value
d = Pi * (a*a)/4;
e = (b)/231;
f = (d * e);
document.form1.total.value = f;
a2 = document.form1.a.value;
b2 = document.form1.b2.value;
c2 = Pi * (a2*a2)/4;
d2 = Pi * (b2*b2)/4;
e2 = (c2 - d2);
document.form1.total2.value = e2;
f2 = document.form1.total2.value;
g2 = document.form1.b.value;
h2 = (f2 * g2)/231;
document.form1.total222.value = h2
}
//-->
</script>
and here is where one of the calculator is
<table border=2 cellspacing=1 cellpadding=1 width="366" height="319" bordercolorlight="#FF6633" bordercolordark="#CC3333">
<td colspan=3 align=center height="31" bgcolor="0099FF"><font face="Times New Roman, Times, serif" size="3" color="#990033"><b>
<h4>Hydraulic Cylinder Volume Capacity Calculator</b></h4></font> </td>
<tr>
<td height="212" width="117">
<div align="center"><font size="3"><b>Enter Cylinder Bore Diameter
in Inches<br>
<input type="text" name="a" size=15 maxlength="15">
<br>
</b></font> <b><font size="2">Enter Cylinder Rod Diameter in
Inches</font></b><br>
<input type="text" name="b2" size=15 maxlength="15">
<br>
<b><font size="2">Enter Cylinder<br>
Stroke in Inches<br>
</font></b>
<input type="text" name="b" size=15 maxlength="15">
</div>
</td>
<td height="212" width="84">
<div align="center"><br>
<br>
<input type="button" value="Calculate" onClick="calc()" name="Calculate">
<br><br><br>
<input type="reset" value="Reset" name="reset">
</div>
</td>
<td height="212" width="142">
<div align="center"><font size="2"><b>Cylinder Effective Area
<br>
<input type="text" name="total2" size=15 maxlength="15">
<br>
Cylinder Volume Capacity In Gallons Of Fluid</b></font> <b><font size="2">Extended<br>
</font></b><font size="2"> </font>
<input type="text" name="total" size=15 maxlength="15">
<br>
<font size="2"><b>Cylinder Volume Capacity In Gallons Of Fluid</b></font>
<b><font size="2">Retracted <br>
<input type="text" name="total222" size=15 maxlength="15">
</font></b></div>
</td>
Any help is much appreciated