This script is supposed to add the cost of the items in the select menu, but it is only showing the total cost as the value of the last item in the menu. Here is the javascript I am using:
[CODE]<script language=”JavaScript”>
var Cost, Grand_Total;
function tally()
{
Cost = 0;
if (document.orderform.value=”Print1″) {Cost = 10}
if (document.orderform.value=”Print2″) {Cost = 20}
if (document.orderform.value=”Print3″) {Cost = 30}
document.orderform.Total.value = “£” + Cost;
}
function pound (amount)
{
amount = parseInt(amount * 100);
amount = parseFloat(amount/100);
if (((amount) == Math.floor(amount)) && ((amount – Math.floor (amount)) == 0))
{
amount = amount + “.00”
return amount;
}
if ( ((amount * 10) – Math.floor(amount * 10)) == 0)
{
amount = amount + “0”;
return amount;
}
if ( ((amount * 100) – Math.floor(amount * 100)) == 0)
{
amount = amount;
return amount;
}
return amount;
}
</script>
Here is the html that I am using:
[code=html]<table border=”0″>
<tr>
<td><label>
<select name=”prints”>
<option selected=”selected”>Options</option>
<option value=”Print1″ onClick=”tally()”>Print1</option>
<option value=”Print2″ onClick=”tally()”>Print2</option>
<option value=”Print3″ onClick=”tally()”>Print3</option>
</select>
</label></td>
<td> </td>
</tr>
<tr>
<td> Total</td>
<td><input type=”text” name=”Total” value=”£0″ size=”7″ /></td>
</tr>
Thanks in advance for any help, I am completly clueless about this sort of thing, but really need the script for my site!