PDA

View Full Version : dynamic quote calculator


jimsaxton
10-23-2002, 09:53 PM
I am trying to find a quote calculator to put on a web page.
The application is to calculate the cost of cleaning in a house. Variables being 'No. of rooms'; 'No. of settees';'No. of chairs' with a static value against each of the three variables and the quote simply adding the products of the three variables and their respective static values.
Is there some code available that I could modify to get this done?

ACJavascript
10-24-2002, 03:28 PM
Could you post your calculator script here.. It would be eisear to see how to do it with the script. :D

jalarie
10-25-2002, 02:02 PM
<!doctype HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">

<html lang="en-US">
<head>

<title>House Cleaning Quote</title>

<!-- jimsaxton -->

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-5">
<meta name="Author" content="James A. Alarie - jalarie@umich.edu" />
<link rev="made" href="mailto:jalarie@umich.edu" />

<meta name="MSSmartTagsPreventParsing" content="TRUE" />

<script type="text/javascript">
<!-- Hide this code from non-JavaScript browsers
function TotalIt() {
CostPerRoom=103.47;
CostPerSettee=47.02;
CostPerChair=12.17;

f1=document.forms[0]; // abbreviation

RI=f1.SelR.selectedIndex;
RV=RI*CostPerRoom;
SI=f1.SelS.selectedIndex;
SV=SI*CostPerSettee;
CI=f1.SelC.selectedIndex;
CV=CI*CostPerChair;
TV=RV*1+SV*1+CV*1;

RV=Math.round(RV*100)/100;
SV=Math.round(SV*100)/100;
CV=Math.round(CV*100)/100;
TV=Math.round(TV*100)/100;

f1.TotR.value=RV;
f1.TotS.value=SV;
f1.TotC.value=CV;
f1.Total.value=TV;

return true;
}
// End hiding -->
</script>

</head>

<body background="jaa_bgnd.jpg" bgcolor="#ffffee" text="black"
link="blue" vlink="#800088" alink="red">
<!-- Page Header -->
<center><h1>House Cleaning Quote</h1></center>
<hr />

<!-- Content -->
<center>
<form action="">
<table border="1" cellspacing="2" cellpadding="2">
<thead>
<tr>
<th bgcolor="#ffffcc" colspan="3">Cost of Cleaning</th>
</tr>
<tr>
<th bgcolor="#ffffcc">Items</th>
<th bgcolor="#ffffcc">Count</th>
<th bgcolor="#ffffcc">Cost</th>
</tr>
</thead>
<tbody>
<tr>
<td bgcolor="aqua">No. of Rooms</td>
<td bgcolor="aqua">
<select name="SelR">
<option>- Pick One -</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
</select>
</td>
<td bgcolor="aqua">
<input type="text" name="TotR" onfocus="this.blur();" />
</td>
</tr>
<tr>
<td bgcolor="aqua">No. of Settees</td>
<td bgcolor="aqua">
<select name="SelS">
<option>- Pick One -</option>
<option>1</option>
<option>2</option>
<option>3</option>
</select>
</td>
<td bgcolor="aqua">
<input type="text" name="TotS" onfocus="this.blur();" />
</td>
</tr>
<tr>
<td bgcolor="aqua">No. of Chairs</td>
<td bgcolor="aqua">
<select name="SelC">
<option>- Pick One -</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</td>
<td bgcolor="aqua">
<input type="text" name="TotC" onfocus="this.blur();" />
</td>
</tr>
<tr>
<td bgcolor="#ffcccc" colspan="3" align="center">
<input type="button" value=" Compute " onclick="TotalIt();" />&nbsp;
<input type="reset" value=" Clear ">
</td>
</tr>
<tr>
<td bgcolor="#ccffcc" colspan="2">Total</td>
<td bgcolor="#ccffcc">
<input type="text" name="Total" onfocus="this.blur();" />
</td>
</tr>
</tbody>
</table>
</form>
</center>

<!-- Page Footer -->
<br clear="all" /><hr />
Written on October 25, 2002, by:&nbsp;
<a href="mailto:jalarie@umich.edu">James Alarie</a>

</body>

</html>

jimsaxton
10-28-2002, 03:58 PM
James,

Thanks for posting code for cost of cleraning house it is great, I presume you don't mind if i now build it in to my web site.

Jim Saxton

jalarie
10-29-2002, 12:42 PM
jimsaxton, the code is provided as-is, for free, to do with as you wish. You may find other things of use at my site at:

&nbsp;http://spruce.flint.umich.edu/~jalarie/