PDA

View Full Version : Need Help



musty202
06-20-2011, 04:41 AM
i need help, i want to display whatever i pick from the list with whatever quantity i choose in another page in tabular form, and show the total at the butom, can anyone assist me on this???
This is what i have so far


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Quantity Cost Calculations</title>
<script type="text/javascript">
// From: http://www.codingforums.com/showthread.php?t=228191

function $_(IDS) { return document.getElementById(IDS); }

function getRBtnName(GrpName) {
var sel = document.getElementsByName(GrpName);
var fnd = -1;
var str = '';
for (var i=0; i<sel.length; i++) {
if (sel[i].checked == true) { str = sel[i].value; fnd = i; }
}
// return fnd; // return option index of selection
// comment out next line if option index used in line above
return str;
}

function Estimate() {
var sum = 0;
if ($_('costNO').checked) { sum += Number($_('costNO').value) * Number($_('cntNO').value); }
if ($_('costNE').checked) { sum += Number($_('costNE').value) * Number($_('cntNE').value); }

var tmp = getRBtnName('costMilo');
if (tmp == '289.99') { sum += Number(tmp) * Number($_('cntOM').value); }
if (tmp == '339.99') { sum += Number(tmp) * Number($_('cntMF').value); }

$_('costEstimate').value = sum.toFixed(2);
}

function EstimateCalc() {
Estimate();
return true; // change this to 'true' after testing.
}

</script>
<style type="text/css">
.style1 {
color: #00FF00;
font-family: Geneva, Arial, Helvetica, sans-serif;
font-size: 36px;
}
</style>
</head>

<body>
<form name="myForm" action="" method="post" onsubmit="return EstimateCalc()">
<table width="669" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="11" height="41">&nbsp;</td>
<td width="173">&nbsp;</td>
<td colspan="4" valign="top"><span class="style1">Price Quotation </span></td>
<td width="10">&nbsp;</td>
<td width="65">&nbsp;</td>
<td width="42">&nbsp;</td>
<td width="44">&nbsp;</td>
</tr>
<tr>
<td height="15"></td>
<td></td>
<td width="73"></td>
<td width="59"></td>
<td width="64"></td>
<td width="128"></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="19"></td>
<td colspan="2" valign="top"><div align="center">Product and Brands </div></td>
<td></td>
<td valign="top"><div align="center">Quantity</div></td>
<td></td>
<td></td>
<td colspan="2" valign="top"><div align="center">Amount Each </div></td>
<td></td>
</tr>
<tr>
<td height="13"></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="19"></td>
<td colspan="8" valign="top" bgcolor="#CCCCCC">Nescafe Product </td>
<td></td>
</tr>
<tr>
<td height="22"></td>
<td>&nbsp;</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="22">&nbsp;</td>
<td colspan="2" valign="top"><label>
<div align="left">
<input type="checkbox" name="costNO" id="costNO" value="300.00" />
Nescafe Original</div>
</label></td>
<td>&nbsp;</td>
<td valign="top"><label>
<select id="cntNO" name="cntNO" size="1">
<option value="1" selected="selected">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="10">10</option>
</select>
</label></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td colspan="2" valign="top"><div align="center">$ 300.00 </div></td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="31">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="19"></td>
<td colspan="2" rowspan="2" valign="top"><label>
<div align="left">
<input type="checkbox" name="costNE" id="costNE" value="299.99" />
Nescafe Espresso </div>
</label></td>
<td></td>
<td rowspan="2" valign="top"><label>
<select id="cntNE" name="cntNE" size="1">
<option value="1" selected="selected">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="10">10</option>
</select>
</label></td>
<td></td>
<td></td>
<td colspan="2" valign="top"><div align="center">$ 299.99 </div></td>
<td></td>
</tr>
<tr>
<td height="3"></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="30"></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="19"></td>
<td colspan="8" valign="top" bgcolor="#CCCCCC"><div align="left">MILO Product </div></td>
<td></td>
</tr>
<tr>
<td height="29"></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="23"></td>
<td colspan="2" valign="top"><label>
<div align="left">
<input name="costMilo" type="radio" value="289.99" />
The original Milo </div>
</label></td>
<td></td>
<td valign="top"> <select id="cntOM" name="cntOM" size="1">
<option value="1" selected="selected">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="10">10</option>
</select></td>
<td></td>
<td></td>
<td colspan="2" valign="top"><div align="center">$ 289.99 </div></td>
<td></td>
</tr>
<tr>
<td height="26"></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="22"></td>
<td colspan="2" valign="top"><label>
<div align="left">
<input name="costMilo" type="radio" value="339.99" />
Milo Fuze </div>
</label></td>
<td></td>
<td valign="top"><select id="cntMF" name="cntMF" size="1">
<option value="1" selected="selected">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="10">10</option>
</select></td>
<td>&nbsp;</td>
<td></td>
<td colspan="2" valign="top"><div align="center">$ 339.99 </div></td>
<td></td>
</tr>
<tr>
<td height="46"></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td></td>
<td></td>
<td></td>
<td><button onclick="Estimate()">Estimate Cost</td>
<td><input type="text" id="costEstimate" value="" readonly></td>
<td>&nbsp;</td>
<td></td>
</tr>
<tr>
<td height="24"></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td valign="top"><label>
<input type="submit" name="Submit" value="Submit" />
</label></td>
<td>&nbsp;</td>
<td></td>
</tr>
<tr>
<td height="112"></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td></td>
</tr>
</table>
</form>
</body>
</html>