shopping cart problem
I've got a problem with a shopping cart - I have some code that works fine but I need to convert a number to a string in order to pass the variable to the next page:
this is part of the code:
function CalcForm(theSel){
var qty = Math.round(theSel.options[theSel.selectedIndex].value);
if(qty == 1){
var total = 2.17+1.20;
document.myform.shipping.value = "£1.20";
}else if(qty == 2){
var total = 4.34+2.40;
document.myform.shipping.value = "£2.40";
I need the 'qty == 2' for example to be 2 x product instead of 2;
Further on in the page I have a select box for the values:
<select name="qty" onChange="CalcForm(this);">
<option value="1" selected>Twin pack £2.17</option>
<option value="2">2 x Twin pack £4.34</option>
</select>
I need the option value to read 2 x product or 1 x product, not just 1 or 2.
I'm stuck as to how to do this - can anyone help?
thanks
Adam
|