mnroof
09-01-2004, 10:12 PM
Here is what i have i have several more items to list want to be able to total all items also want to be able to change the input name from quantity0 thru quantity9 to a name i will recognize like the item name see how html is for fasteners. i know this page is not correctly laid ou but i think you should get general idea i have 50 items to list this way.
<SCRIPT LANGUAGE="JavaScript"><!--
function cent(amount) {
return (amount == Math.floor(amount)) ? amount + '.00' : ( (amount*10 == Math.floor(amount*10)) ? amount + '0' : amount);
}
function total(what,number) {
var grandTotal = 0;
for (var i=0;i<number;i++) {
if (what.elements['price' + i].value == '')
what.elements['price' + i].value == '0.00'; // fix for Opera.
grandTotal += (what.elements['price' + i].value - 0) * (what.elements['quantity' + i].value - 0);
}
what.grandTotal.value = cent(Math.round(grandTotal*Math.pow(10,2))/Math.pow(10,2));
}
//--></SCRIPT>
<form>
<td align="left" nowrap> Total Squares needed (1 square Covers 100 square feet):<input type="text" name="quantity0" size="5" maxlength="4" style="margin-top: 20px"><input TYPE="hidden" NAME="price0" VALUE="0.99" SIZE="4"><b>@ $33.50 Per Sq.</b></td></tr>
<tr>
<td align="left">GAF Timberline: <select name="Timberline" name="Timberline" size="1" maxlength="20" style="margin-top: 20px">
<option>None</option>
<option>Burnt Sienna</option>
<option>Cedar Blend</option>
<option>Charcoal Blend</option>
<option>Midnight Green</option>
<option>Heather Blend</option>
<option>Fox Hollow Gray</option>
<option>Slate Blend</option>
<option>Mission Brown</option>
<option>Pewter Gray</option>
<option>Weathered Wood</option>
<option>Williamsberg Slate</option>
<td align="left" nowrap> Total Squares needed (1 square Covers 100 square feet):<input type="text" name="quantity1" size="5" maxlength="4" style="margin-top: 20px"><input TYPE="hidden" NAME="price1" VALUE="1.99" SIZE="4"><b>See Timberline Grade for pricing</b></td></tr>
<tr>
<td align="left" nowrap>Timberline Grade <select name="year" name="year" size="1" maxlength="20" style="margin-top: 10px">
<option>None</option>
<option>30 year $45.00 per sq</option>
<option>40 year $65.00 per sq</option>
<option>Ultra $75.00 per sq (special Order)</option>
<td align="left" nowrap>Hip And Ridge (1 Bundle Covers 20 Linear Feet) Total Bundles:<input type="text" name="quantity2" size="5" maxlength="4" style="margin-top: 10px"><input TYPE="hidden" NAME="price2" VALUE="2.99" SIZE="4"><b>@ $28.00 per Bndle.</b></td></tr>
<table border="4" align="center" style="margin-top: 20px" width="300" bordercolor="#000000" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><font size="6"><b>Underlayment</b></font></tr></td>
<table border="0" style="margin: Auto" width="794">
<tr>
<td align="left" nowrap> GAF Weather Watch 1.5 Square Roll: <input type="text" name="quantity3" size="3" maxlength="4" style="margin-top: 20px"><input TYPE="hidden" NAME="price3" VALUE="3.99" SIZE="4"><b> Rolls @ $42.00 Per Roll ---</b>
<td align="left" nowrap> Certainteed Winter Guard 2 Square Roll: <input type="text" name="quantity4" size="3" maxlength="4" style="margin-top: 20px"><input TYPE="hidden" NAME="price4" VALUE="4.99" SIZE="4"><b> Rolls @ $52.00 Per Roll</b></td></tr>
<tr>
<td align="left" nowrap> Grace Ice And Water Shield 2 Square Roll: <input type="text" name="quantity5" size="3" maxlength="3" style="margin-top: 20px"><input TYPE="hidden" NAME="price5" VALUE="5.99" SIZE="4"><b> Rolls @ $85.00 Per Roll ---</b>
<td align="left" nowrap> Grace Ice And Water Shield 1 Square Roll: <input type="text" name="quantity6" size="3" maxlength="3" style="margin-top: 20px"><input TYPE="hidden" NAME="price6" VALUE="6.99" SIZE="4"><b> Rolls @ $44.00 Per Roll</b></td></tr>
<tr>
<td align="left" nowrap> Gaf Shinglemate #15 Pound Felt 4 Square Roll: <input type="text" name="quantity7" size="3" maxlength="3" style="margin-top: 20px"><input TYPE="hidden" NAME="price7" VALUE="7.99" SIZE="4"><b> Rolls @ $20.00 Per Roll ---</b>
<td align="left" nowrap> Certainteed Select #15 pound Felt 4 Square Roll: <input type="text" name="quantity8" size="3" maxlength="3" style="margin-top: 20px"><input TYPE="hidden" NAME="price8" VALUE="8.99" SIZE="4"><b> Rolls @ $18.00 Per Roll</b></td></tr>
<tr>
<td align="left" nowrap> Tamko #15 pound Felt 4 Square Roll: <input type="text" name="quantity9" size="3" maxlength="3" style="margin-top: 20px"><input TYPE="hidden" NAME="price9" VALUE="9.99" SIZE="4"><b> Rolls @ $20.00 Per Roll ---</b>
<td align="left" nowrap> Tamko #30 Pound 2 Square Rolll: <input type="text" name="quan" size="3" maxlength="3" style="margin-top: 20px"><b> Rolls @ $19.00 Per Roll</b></td></tr>
<table border="4" align="center" style="margin-top: 20px" width="300" bordercolor="#000000" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><font size="6"><b>Fasteners</b></font></tr></td>
<table border="0" style="margin: Auto" width="794">
<tr>
<td align="left" nowrap> 1" coil Nails (1 Box Averages 16 Square): <input type="text" name="1 Coil" size="3" maxlength="4" style="margin-top: 20px"><b> Boxes @ $33.00 Per Box ---</b>
<td align="left" nowrap> 1 1/4" coil Nails (1 Box Averages 16 Square): <input type="text" name="1 1/4 Coil" size="3" maxlength="4" style="margin-top: 20px"><b> Boxes @ $36.00 Per Box</b></td></tr>
<tr>
<td align="left" nowrap> 1 1/2" coil Nails (1 Box Averages 16 Square): <input type="text" name="1 1/2 Coil" size="3" maxlength="4" style="margin-top: 20px"><b> Boxes @ $38.00 Per Box ---</b>
<td align="left" nowrap> 1 3/4" coil Nails (1 Box Averages 16 Square): <input type="text" name="1 3/4 Coil" size="3" maxlength="4" style="margin-top: 20px"><b> Boxes @ $48.00 Per Box</b></td></tr>
<tr>
<INPUT TYPE="button" VALUE="Total" onClick="total(this.form,10)"> Grand Total: <INPUT TYPE="TEXT" NAME="grandTotal" SIZE="6">
</tr>
</form>
<SCRIPT LANGUAGE="JavaScript"><!--
function cent(amount) {
return (amount == Math.floor(amount)) ? amount + '.00' : ( (amount*10 == Math.floor(amount*10)) ? amount + '0' : amount);
}
function total(what,number) {
var grandTotal = 0;
for (var i=0;i<number;i++) {
if (what.elements['price' + i].value == '')
what.elements['price' + i].value == '0.00'; // fix for Opera.
grandTotal += (what.elements['price' + i].value - 0) * (what.elements['quantity' + i].value - 0);
}
what.grandTotal.value = cent(Math.round(grandTotal*Math.pow(10,2))/Math.pow(10,2));
}
//--></SCRIPT>
<form>
<td align="left" nowrap> Total Squares needed (1 square Covers 100 square feet):<input type="text" name="quantity0" size="5" maxlength="4" style="margin-top: 20px"><input TYPE="hidden" NAME="price0" VALUE="0.99" SIZE="4"><b>@ $33.50 Per Sq.</b></td></tr>
<tr>
<td align="left">GAF Timberline: <select name="Timberline" name="Timberline" size="1" maxlength="20" style="margin-top: 20px">
<option>None</option>
<option>Burnt Sienna</option>
<option>Cedar Blend</option>
<option>Charcoal Blend</option>
<option>Midnight Green</option>
<option>Heather Blend</option>
<option>Fox Hollow Gray</option>
<option>Slate Blend</option>
<option>Mission Brown</option>
<option>Pewter Gray</option>
<option>Weathered Wood</option>
<option>Williamsberg Slate</option>
<td align="left" nowrap> Total Squares needed (1 square Covers 100 square feet):<input type="text" name="quantity1" size="5" maxlength="4" style="margin-top: 20px"><input TYPE="hidden" NAME="price1" VALUE="1.99" SIZE="4"><b>See Timberline Grade for pricing</b></td></tr>
<tr>
<td align="left" nowrap>Timberline Grade <select name="year" name="year" size="1" maxlength="20" style="margin-top: 10px">
<option>None</option>
<option>30 year $45.00 per sq</option>
<option>40 year $65.00 per sq</option>
<option>Ultra $75.00 per sq (special Order)</option>
<td align="left" nowrap>Hip And Ridge (1 Bundle Covers 20 Linear Feet) Total Bundles:<input type="text" name="quantity2" size="5" maxlength="4" style="margin-top: 10px"><input TYPE="hidden" NAME="price2" VALUE="2.99" SIZE="4"><b>@ $28.00 per Bndle.</b></td></tr>
<table border="4" align="center" style="margin-top: 20px" width="300" bordercolor="#000000" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><font size="6"><b>Underlayment</b></font></tr></td>
<table border="0" style="margin: Auto" width="794">
<tr>
<td align="left" nowrap> GAF Weather Watch 1.5 Square Roll: <input type="text" name="quantity3" size="3" maxlength="4" style="margin-top: 20px"><input TYPE="hidden" NAME="price3" VALUE="3.99" SIZE="4"><b> Rolls @ $42.00 Per Roll ---</b>
<td align="left" nowrap> Certainteed Winter Guard 2 Square Roll: <input type="text" name="quantity4" size="3" maxlength="4" style="margin-top: 20px"><input TYPE="hidden" NAME="price4" VALUE="4.99" SIZE="4"><b> Rolls @ $52.00 Per Roll</b></td></tr>
<tr>
<td align="left" nowrap> Grace Ice And Water Shield 2 Square Roll: <input type="text" name="quantity5" size="3" maxlength="3" style="margin-top: 20px"><input TYPE="hidden" NAME="price5" VALUE="5.99" SIZE="4"><b> Rolls @ $85.00 Per Roll ---</b>
<td align="left" nowrap> Grace Ice And Water Shield 1 Square Roll: <input type="text" name="quantity6" size="3" maxlength="3" style="margin-top: 20px"><input TYPE="hidden" NAME="price6" VALUE="6.99" SIZE="4"><b> Rolls @ $44.00 Per Roll</b></td></tr>
<tr>
<td align="left" nowrap> Gaf Shinglemate #15 Pound Felt 4 Square Roll: <input type="text" name="quantity7" size="3" maxlength="3" style="margin-top: 20px"><input TYPE="hidden" NAME="price7" VALUE="7.99" SIZE="4"><b> Rolls @ $20.00 Per Roll ---</b>
<td align="left" nowrap> Certainteed Select #15 pound Felt 4 Square Roll: <input type="text" name="quantity8" size="3" maxlength="3" style="margin-top: 20px"><input TYPE="hidden" NAME="price8" VALUE="8.99" SIZE="4"><b> Rolls @ $18.00 Per Roll</b></td></tr>
<tr>
<td align="left" nowrap> Tamko #15 pound Felt 4 Square Roll: <input type="text" name="quantity9" size="3" maxlength="3" style="margin-top: 20px"><input TYPE="hidden" NAME="price9" VALUE="9.99" SIZE="4"><b> Rolls @ $20.00 Per Roll ---</b>
<td align="left" nowrap> Tamko #30 Pound 2 Square Rolll: <input type="text" name="quan" size="3" maxlength="3" style="margin-top: 20px"><b> Rolls @ $19.00 Per Roll</b></td></tr>
<table border="4" align="center" style="margin-top: 20px" width="300" bordercolor="#000000" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><font size="6"><b>Fasteners</b></font></tr></td>
<table border="0" style="margin: Auto" width="794">
<tr>
<td align="left" nowrap> 1" coil Nails (1 Box Averages 16 Square): <input type="text" name="1 Coil" size="3" maxlength="4" style="margin-top: 20px"><b> Boxes @ $33.00 Per Box ---</b>
<td align="left" nowrap> 1 1/4" coil Nails (1 Box Averages 16 Square): <input type="text" name="1 1/4 Coil" size="3" maxlength="4" style="margin-top: 20px"><b> Boxes @ $36.00 Per Box</b></td></tr>
<tr>
<td align="left" nowrap> 1 1/2" coil Nails (1 Box Averages 16 Square): <input type="text" name="1 1/2 Coil" size="3" maxlength="4" style="margin-top: 20px"><b> Boxes @ $38.00 Per Box ---</b>
<td align="left" nowrap> 1 3/4" coil Nails (1 Box Averages 16 Square): <input type="text" name="1 3/4 Coil" size="3" maxlength="4" style="margin-top: 20px"><b> Boxes @ $48.00 Per Box</b></td></tr>
<tr>
<INPUT TYPE="button" VALUE="Total" onClick="total(this.form,10)"> Grand Total: <INPUT TYPE="TEXT" NAME="grandTotal" SIZE="6">
</tr>
</form>