Posted on 2007-10-16
I have the script below, it takes a number of check boxes that are options with prices to a main number for example I have a main car price, and adding three different option groups to give me the new total.
for (i=0;i<optionValues.length;++ i)
txt=Number(txt) + Number(optionValues[i].value)
totalnum = onum + ntxt
ntotalnum = Math.round(totalnum*100)/100;
document.getElementById("oValues").value = ntotalnum
The option boxes look like this
<input checked="checked" onclick="createOrder()" name="optionValues" type="checkbox" value=VALUE />
Then there is the box that gets written the value
<input type="text" id="oValues" size="15" class="valueBox">
This code works great, it is clean and fast to update. I just have 1 main problems.
With that code and having all checkboxes named the same I can not pass this value on in a form element to another page.
Any ideas how to rewrite the code so that the element names are different so I can pass them through the form. I have tried a number or things and when I do it, it will not pass any values.