I need some help with this: I'm using this form to calculate the cost of cleaning rooms, however I need the results to not show in an alert window, rather have it display in a field called (total) below the calculate button.... also the client wants three prices ( the total; then another field which is 2x the total; and other field which is 2.5x the total; for 3 price ranges).
Is this possible with what I have already done here - I've gone about as far as my abilities allow.... OR is there a simpler way to do all of this???
--------
<html>
<head>
<title> -- </title>
</head>
<body bgcolor="#FFFFFF" text="#000000" marginwidth="0" marginheight="0" topmargin="20" leftmargin="0">
<table width="525" border="0" cellspacing="1" cellpadding="0" bgcolor="#FF9900" align="center">
<tr>
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="1" height="363" align="center" bgcolor="#FFFFFF">
<tr>
<td height="2">
<form name="calculate" method="post" action="">
<table width="100%" border="0" cellspacing="2" cellpadding="4"
height="95">
<tr>
<td width="86%" height="2"><b> <font size="-1" face="Arial">Number
of living & or family rooms.</font></b></td>
<td width="14%" align="CENTER" height="2">
<div align="center"><font face="Arial">
<input type="text" name="rooms" size="3"
value="0">
</font> </div>
</td>
</tr>
<tr>
<td width="86%" height="2"><b> <font size="-1" face="Arial">Number
of combination living/dining areas [ count as 2 rooms ]</font></b></td>
<td width="14%" height="2" align="CENTER">
<div align="center"><font face="Arial">
<input type="text" name="comboroom" size="3" value="0">
</font></div>
</td>
</tr>
<tr>
<td width="86%" height="2"><b> <font size="-1" face="Arial">Number
of double size bedrooms. [ count as 2 rooms ]</font></b></td>
<td width="14%" height="2" align="CENTER">
<div align="center"><font face="Arial">
<input type="text" name="dblbed"
size="3" value="0">
</font></div>
</td>
</tr>
<tr>
<td width="86%" height="2"><b> <font size="-1" face="Arial">Number
of standard size bedrooms.</font></b></td>
<td width="14%" height="2" align="CENTER">
<div align="center"><font face="Arial">
<input type="text" name="bedrms" size="3"
value="0">
</font></div>
</td>
</tr>
<tr>
<td width="86%" height="2"><b> <font size="-1" face="Arial">Number
of bathrooms. [ Average bathroom 5x10 ]</font></b></td>
<td width="14%" height="2" align="CENTER">
<div align="center"><font face="Arial">
<input type="text" name="bathrms" size="3"
value="0">
</font></div>
</td>
</tr>
<tr>
<td width="86%" height="2"><b> <font size="-1" face="Arial">Number
of hallways. [ Average hallway 10-15 ]</font></b></td>
<td width="14%" height="2" align="CENTER">
<div align="center"><font face="Arial">
<input type="text" name="hallways" size="3"
value="0">
</font> </div>
</td>
</tr>
<tr>
<td width="86%" height="2"><b> <font size="-1" face="Arial">Number
of stairways. [ 15 stairs per set ]</font></b></td>
<td width="14%" height="2" align="CENTER">
<div align="center"><font face="Arial">
<input type="text" name="others" size="3"
value="0">
</font></div>
</td>
</tr>
<tr>
<td width="86%" height="2"><b> <font size="-1" face="Arial">Number
of Closets. [ Average closet 5x10 ]</font></b></td>
<td width="14%" height="2" align="CENTER">
<div align="center"><font face="Arial">
<input type="text" name="closets" size="3" value="0">
</font></div>
</td>
</tr>
</table>
<div align="center"><font color="#0000FF">
<script language="JavaScript">
function calculate(form)
{
rooms = eval(form.rooms.value)
comboroom = eval(form.comboroom.value)
dblbed = eval(form.dblbed.value)
bedrms = eval(form.bedrms.value)
bathrms = eval(form.bathrms.value)
hallways = eval(form.hallways.value)
others = eval(form.others.value)
closets = eval(form.closets.value)
GetPriceOne (form, rooms, comboroom, dblbed, bedrms, bathrms, hallways, others, closets)
}
function GetPriceOne(form, rooms, comboroom, dblbed, bedrms, bathrms, hallways, others, closets)
{
PriceOne = rooms * 30
GetPriceTwo(form, rooms, comboroom, dblbed, bedrms, bathrms, hallways, others, closets, PriceOne)
}
function GetPriceTwo(form, rooms, comboroom, dblbed, bedrms, bathrms, hallways, others, closets, PriceOne)
{
PriceTwo = PriceOne + (comboroom * 60)
GetPriceThree(form, rooms, comboroom, dblbed, bedrms, bathrms, hallways, others, closets, PriceTwo)
}
function GetPriceThree(form, rooms, comboroom, dblbed, bedrms, bathrms, hallways, others, closets, PriceTwo)
{
PriceThree = PriceTwo + (dblbed * 60)
GetPriceFour(form, rooms, comboroom, dblbed, bedrms, bathrms, hallways, others, closets, PriceThree)
}
function GetPriceFour(form, rooms, comboroom, dblbed, bedrms, bathrms, hallways, others, closets, PriceThree)
{
PriceFour = PriceThree + (bedrms * 23)
GetPriceFive(form, rooms, comboroom, dblbed, bedrms, bathrms, hallways, others, closets, PriceFour)
}
function GetPriceFive(form, rooms, comboroom, dblbed, bedrms, bathrms, hallways, others, closets, PriceFour)
{
PriceFive = PriceFour + (bathrms * 10)
GetPriceSix(form, rooms, comboroom, dblbed, bedrms, bathrms, hallways, others, closets, PriceFive)
}
function GetPriceSix(form, rooms, comboroom, dblbed, bedrms, bathrms, hallways, others, closets, PriceFive)
{
PriceSix = PriceFive + (hallways * 15)
GetPriceSeven(form, rooms, comboroom, dblbed, bedrms, bathrms, hallways, others, closets, PriceSix)
}
function GetPriceSeven(form, rooms, comboroom, dblbed, bedrms, bathrms, hallways, others, closets, PriceSix)
{
PriceSeven = PriceSix + (others * 30)
GetPriceEight(form, rooms, comboroom, dblbed, bedrms, bathrms, hallways, others, closets, PriceSeven)
}
function GetPriceEight(form, rooms, comboroom, dblbed, bedrms, bathrms, hallways, others, closets, PriceSeven)
{
total = PriceSeven + (closets * 10)
WriteDocument(total)
}
function RoundTocents
{
cents = n * 100;
cents = Math.round(cents);
strcents = "" + cents;
len = strcents.length;
return strcents.substring(0, len - 2) + "." + strcents.substring(len - 2, len);
}
function WriteDocument(total)
{
alert("The total cost is $" + RoundTocents(total))
}
</script>
</font><font face="Arial"> </font>
<input type="button"
value="Calculate Estimate" name="B1" onClick="calculate(this.form)">
<input type="reset" value="Clear" name="B2">
<font color="#0000FF"> </font> </div>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
Is this possible with what I have already done here - I've gone about as far as my abilities allow.... OR is there a simpler way to do all of this???
--------
<html>
<head>
<title> -- </title>
</head>
<body bgcolor="#FFFFFF" text="#000000" marginwidth="0" marginheight="0" topmargin="20" leftmargin="0">
<table width="525" border="0" cellspacing="1" cellpadding="0" bgcolor="#FF9900" align="center">
<tr>
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="1" height="363" align="center" bgcolor="#FFFFFF">
<tr>
<td height="2">
<form name="calculate" method="post" action="">
<table width="100%" border="0" cellspacing="2" cellpadding="4"
height="95">
<tr>
<td width="86%" height="2"><b> <font size="-1" face="Arial">Number
of living & or family rooms.</font></b></td>
<td width="14%" align="CENTER" height="2">
<div align="center"><font face="Arial">
<input type="text" name="rooms" size="3"
value="0">
</font> </div>
</td>
</tr>
<tr>
<td width="86%" height="2"><b> <font size="-1" face="Arial">Number
of combination living/dining areas [ count as 2 rooms ]</font></b></td>
<td width="14%" height="2" align="CENTER">
<div align="center"><font face="Arial">
<input type="text" name="comboroom" size="3" value="0">
</font></div>
</td>
</tr>
<tr>
<td width="86%" height="2"><b> <font size="-1" face="Arial">Number
of double size bedrooms. [ count as 2 rooms ]</font></b></td>
<td width="14%" height="2" align="CENTER">
<div align="center"><font face="Arial">
<input type="text" name="dblbed"
size="3" value="0">
</font></div>
</td>
</tr>
<tr>
<td width="86%" height="2"><b> <font size="-1" face="Arial">Number
of standard size bedrooms.</font></b></td>
<td width="14%" height="2" align="CENTER">
<div align="center"><font face="Arial">
<input type="text" name="bedrms" size="3"
value="0">
</font></div>
</td>
</tr>
<tr>
<td width="86%" height="2"><b> <font size="-1" face="Arial">Number
of bathrooms. [ Average bathroom 5x10 ]</font></b></td>
<td width="14%" height="2" align="CENTER">
<div align="center"><font face="Arial">
<input type="text" name="bathrms" size="3"
value="0">
</font></div>
</td>
</tr>
<tr>
<td width="86%" height="2"><b> <font size="-1" face="Arial">Number
of hallways. [ Average hallway 10-15 ]</font></b></td>
<td width="14%" height="2" align="CENTER">
<div align="center"><font face="Arial">
<input type="text" name="hallways" size="3"
value="0">
</font> </div>
</td>
</tr>
<tr>
<td width="86%" height="2"><b> <font size="-1" face="Arial">Number
of stairways. [ 15 stairs per set ]</font></b></td>
<td width="14%" height="2" align="CENTER">
<div align="center"><font face="Arial">
<input type="text" name="others" size="3"
value="0">
</font></div>
</td>
</tr>
<tr>
<td width="86%" height="2"><b> <font size="-1" face="Arial">Number
of Closets. [ Average closet 5x10 ]</font></b></td>
<td width="14%" height="2" align="CENTER">
<div align="center"><font face="Arial">
<input type="text" name="closets" size="3" value="0">
</font></div>
</td>
</tr>
</table>
<div align="center"><font color="#0000FF">
<script language="JavaScript">
function calculate(form)
{
rooms = eval(form.rooms.value)
comboroom = eval(form.comboroom.value)
dblbed = eval(form.dblbed.value)
bedrms = eval(form.bedrms.value)
bathrms = eval(form.bathrms.value)
hallways = eval(form.hallways.value)
others = eval(form.others.value)
closets = eval(form.closets.value)
GetPriceOne (form, rooms, comboroom, dblbed, bedrms, bathrms, hallways, others, closets)
}
function GetPriceOne(form, rooms, comboroom, dblbed, bedrms, bathrms, hallways, others, closets)
{
PriceOne = rooms * 30
GetPriceTwo(form, rooms, comboroom, dblbed, bedrms, bathrms, hallways, others, closets, PriceOne)
}
function GetPriceTwo(form, rooms, comboroom, dblbed, bedrms, bathrms, hallways, others, closets, PriceOne)
{
PriceTwo = PriceOne + (comboroom * 60)
GetPriceThree(form, rooms, comboroom, dblbed, bedrms, bathrms, hallways, others, closets, PriceTwo)
}
function GetPriceThree(form, rooms, comboroom, dblbed, bedrms, bathrms, hallways, others, closets, PriceTwo)
{
PriceThree = PriceTwo + (dblbed * 60)
GetPriceFour(form, rooms, comboroom, dblbed, bedrms, bathrms, hallways, others, closets, PriceThree)
}
function GetPriceFour(form, rooms, comboroom, dblbed, bedrms, bathrms, hallways, others, closets, PriceThree)
{
PriceFour = PriceThree + (bedrms * 23)
GetPriceFive(form, rooms, comboroom, dblbed, bedrms, bathrms, hallways, others, closets, PriceFour)
}
function GetPriceFive(form, rooms, comboroom, dblbed, bedrms, bathrms, hallways, others, closets, PriceFour)
{
PriceFive = PriceFour + (bathrms * 10)
GetPriceSix(form, rooms, comboroom, dblbed, bedrms, bathrms, hallways, others, closets, PriceFive)
}
function GetPriceSix(form, rooms, comboroom, dblbed, bedrms, bathrms, hallways, others, closets, PriceFive)
{
PriceSix = PriceFive + (hallways * 15)
GetPriceSeven(form, rooms, comboroom, dblbed, bedrms, bathrms, hallways, others, closets, PriceSix)
}
function GetPriceSeven(form, rooms, comboroom, dblbed, bedrms, bathrms, hallways, others, closets, PriceSix)
{
PriceSeven = PriceSix + (others * 30)
GetPriceEight(form, rooms, comboroom, dblbed, bedrms, bathrms, hallways, others, closets, PriceSeven)
}
function GetPriceEight(form, rooms, comboroom, dblbed, bedrms, bathrms, hallways, others, closets, PriceSeven)
{
total = PriceSeven + (closets * 10)
WriteDocument(total)
}
function RoundTocents
{
cents = n * 100;
cents = Math.round(cents);
strcents = "" + cents;
len = strcents.length;
return strcents.substring(0, len - 2) + "." + strcents.substring(len - 2, len);
}
function WriteDocument(total)
{
alert("The total cost is $" + RoundTocents(total))
}
</script>
</font><font face="Arial"> </font>
<input type="button"
value="Calculate Estimate" name="B1" onClick="calculate(this.form)">
<input type="reset" value="Clear" name="B2">
<font color="#0000FF"> </font> </div>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>