I want this code to calculate the values when I click the button. How can I get this to work? Is my function wrong? Please help Me! Thanks! Here's the code:
<form name="newForm">
<table border=1 bgcolor="#ffffff">
<tr align="center"><td width=60><b>Item</b></td><td width=10><b>Price</b></td><td width=5><b>Quantity</b></td></tr>
<tr><td>Gloves</td><td>$8.50</td><td><input type="text" name="item1"></td></tr>
<tr><td>Boots</td><td>$65.99</td><td><input type="text" name="item2"></td></tr>
<tr><td>Scarf</td><td>$18.50</td><td><input type="text" name="item3"></td></tr>
<tr><td>Tossel Cap</td><td>$15.50</td><td><input type="text" name="item4"></td><tr>
<tr><td>Ear Muffs</td><td>$6.50</td><td><input type="text" name="item5"></td><tr>
</table>
<script language="javascript">
function myItems(){
var gloves=parseInt(document.newForm.item1.value*8.50);
var boots=parseInt(document.newForm.item2.value*65.99);
var scarf=parseInt(document.newForm.item3.value*18.50);
var tosselCap=parseInt(document.newForm.item4.value*15.50);
var earMuffs=parseInt(document.newForm.item5.value*6.50);
var mySubTotal=gloves+boots+scarf+tosselCap+earMuffs;
var taxTotal=mySubTotal(mySubTotal*0.07);
var finalTotal=(math.ceil(taxTotal*100))/100
}
</script>
<input type="button" value=http://www.webdeveloper.com/forum/archive/index.php/"Calculate" name="myButton" onClick="myItems()">
</form>
<form name="newForm">
<table border=1 bgcolor="#ffffff">
<tr align="center"><td width=60><b>Item</b></td><td width=10><b>Price</b></td><td width=5><b>Quantity</b></td></tr>
<tr><td>Gloves</td><td>$8.50</td><td><input type="text" name="item1"></td></tr>
<tr><td>Boots</td><td>$65.99</td><td><input type="text" name="item2"></td></tr>
<tr><td>Scarf</td><td>$18.50</td><td><input type="text" name="item3"></td></tr>
<tr><td>Tossel Cap</td><td>$15.50</td><td><input type="text" name="item4"></td><tr>
<tr><td>Ear Muffs</td><td>$6.50</td><td><input type="text" name="item5"></td><tr>
</table>
<script language="javascript">
function myItems(){
var gloves=parseInt(document.newForm.item1.value*8.50);
var boots=parseInt(document.newForm.item2.value*65.99);
var scarf=parseInt(document.newForm.item3.value*18.50);
var tosselCap=parseInt(document.newForm.item4.value*15.50);
var earMuffs=parseInt(document.newForm.item5.value*6.50);
var mySubTotal=gloves+boots+scarf+tosselCap+earMuffs;
var taxTotal=mySubTotal(mySubTotal*0.07);
var finalTotal=(math.ceil(taxTotal*100))/100
}
</script>
<input type="button" value=http://www.webdeveloper.com/forum/archive/index.php/"Calculate" name="myButton" onClick="myItems()">
</form>