Hi
I have a Web Form which I need to get results shown to 2 decimal points only.
In the Head I have: -
function heatoutput()
{
var vWidth=document .heatcalculator .roomwidth.valu e;
var vLength=documen t.heatcalculato r.roomlength.va lue;
var vHeight=documen t.heatcalculato r.roomheight.va lue;
var vRoomSize=vWidt h*vLength*vHeig ht;
var rlength = 2
if(document.hea tcalculator.cal cunits.selected Index == 0)
{vRoomSize=vRoo mSize*0.028368; }
document.heatca lculator.result .value=((vRoomS ize / 14));
}
And the Form is: -
<FORM name="heatcalcu lator" method="post">
<table width="100%" border="0" align="center" cellpadding="1" cellspacing="0" bgcolor="#CC000 0">
<tbody>
<tr>
<td><table cellspacing="0" cellpadding="10 " width="100%" border="0">
<tbody>
<tr>
<td><h1 class="Price_Sp ecial">Heat output calculator</h1>
<p class="Price_Sp ecial">Simply key in your room measurements, choose the correct units and click the "equals" button to find the heat output required to adequately heat your room.</p></td>
</tr>
<tr>
<td><div align="center"> <strong class="Price_Sp ecial">Room measurements in:</strong>
<select name="calcunits ">
<option value="feet">Fe et</option>
<option value="metres" selected>Metres </option>
</select>
</div></td>
</tr>
<tr valign="center" >
<td><div align="center" class="Price_Sp ecial"><strong> Length:
<input size="2" name="roomlengt h">
&nb sp; Width:
<input size="2" name="roomwidth ">
&nb sp; Height :
<input size="2" name="roomheigh t">
</strong></div></td>
</tr>
<tr valign="center" >
<td><div align="center" class="Price_Sp ecial"><strong> <a href="JAVASCRIP T:heatoutput()" ><img src="Images/equals.gif" alt="Click for result!" width="24" height="24" border="0" align="absBotto m" class="Price_Sp ecial"></a>
<input size="10" name="result">
kW of heat output needed.</strong></div></td>
</tr>
</tbody>
</table></td>
</tr>
</tbody>
</table>
</FORM>
How do I change this to show answer to 2 decimal points, please?
Many thanks.
Ianhen
I have a Web Form which I need to get results shown to 2 decimal points only.
In the Head I have: -
function heatoutput()
{
var vWidth=document .heatcalculator .roomwidth.valu e;
var vLength=documen t.heatcalculato r.roomlength.va lue;
var vHeight=documen t.heatcalculato r.roomheight.va lue;
var vRoomSize=vWidt h*vLength*vHeig ht;
var rlength = 2
if(document.hea tcalculator.cal cunits.selected Index == 0)
{vRoomSize=vRoo mSize*0.028368; }
document.heatca lculator.result .value=((vRoomS ize / 14));
}
And the Form is: -
<FORM name="heatcalcu lator" method="post">
<table width="100%" border="0" align="center" cellpadding="1" cellspacing="0" bgcolor="#CC000 0">
<tbody>
<tr>
<td><table cellspacing="0" cellpadding="10 " width="100%" border="0">
<tbody>
<tr>
<td><h1 class="Price_Sp ecial">Heat output calculator</h1>
<p class="Price_Sp ecial">Simply key in your room measurements, choose the correct units and click the "equals" button to find the heat output required to adequately heat your room.</p></td>
</tr>
<tr>
<td><div align="center"> <strong class="Price_Sp ecial">Room measurements in:</strong>
<select name="calcunits ">
<option value="feet">Fe et</option>
<option value="metres" selected>Metres </option>
</select>
</div></td>
</tr>
<tr valign="center" >
<td><div align="center" class="Price_Sp ecial"><strong> Length:
<input size="2" name="roomlengt h">
&nb sp; Width:
<input size="2" name="roomwidth ">
&nb sp; Height :
<input size="2" name="roomheigh t">
</strong></div></td>
</tr>
<tr valign="center" >
<td><div align="center" class="Price_Sp ecial"><strong> <a href="JAVASCRIP T:heatoutput()" ><img src="Images/equals.gif" alt="Click for result!" width="24" height="24" border="0" align="absBotto m" class="Price_Sp ecial"></a>
<input size="10" name="result">
kW of heat output needed.</strong></div></td>
</tr>
</tbody>
</table></td>
</tr>
</tbody>
</table>
</FORM>
How do I change this to show answer to 2 decimal points, please?
Many thanks.
Ianhen
Comment