i have a form with 3 radio buttons.
they have 3 values, 0, 5 and 10.
when the checkbox is checked, it adds that ammount to the total figure, currently 0.
i can't get it to work, maybe one of you guys could have a look at the code and tell where i'm going wrong, thanks.
Expand|Select|Wrap|Line Numbers
- <script language="javascript1.2">
- function calculateTotal()
- {
- var price,i;
- for (i=0; i<document.formTotal.shipping.length;i++)
- {
- if (document.formTotal.shipping.checked=true)
- {
- parseInt (document.formTotal.total + 5);
- }
- }
- </script>
and the html.
Expand|Select|Wrap|Line Numbers
- <form name="formTotal" method="post" action="">
- <table width="100%" border="0" cellspacing="1" cellpadding="6">
- <tr>
- <td colspan="3" bgcolor="#FFF7D2"><span class="style3">Please choose your region for shipping </span></td>
- </tr>
- <tr>
- <td align="center"><span class="style1"><strong>Ireland<br />
- </strong>free </span><br />
- <input name="shipping" type="radio" /></td>
- <td align="center"><span class="style1"><strong>Other EU</strong><br />
- €5<br />
- </span>
- <input name="shipping" type="radio" value="5" /></td>
- <td align="center"> <span class="style1"><strong>Rest of World</strong><br />
- €10<br />
- </span>
- <input name="shipping" type="radio" value="10" /></td>
- </tr>
- </table>
- </form>
- <table width="100%" border="0" cellspacing="1" cellpadding="6">
- <tr>
- <td colspan="2" bgcolor="#FFF7D2"><span class="style3">Shopping Cart </span></td>
- </tr>
- <tr>
- <td><span class="style1">Quantity</span></td>
- <td><span class="style1" id="quantity">0</span></td>
- </tr>
- <tr>
- <td><span class="style1">Total</span></td>
- <td><span class="style1" id="total">0</span></td>
- </tr>
- </table>