I have it so that the user can select a number of different quantities for different items with the result of each one being displayed in a textbox.
However I also want there to be another text box that adds up all the values that are displayed automatically but I'm struggling to get this to work, can anyone help...
Below is the code I use to do the working outs for the individual items and this would display it's result in text box "total1"
Code: Select all
<script type="text/javascript">
function calcForm(form,submit_it) {
// By making the first element 0, this associates the list precisely with the select list.
// To maintain all you need to do is change this array.
var prices = new Array('0.00','16.00','24.00','32.00','40.00');
var sel = document.getElementById('num'); // The list
var ind = sel.selectedIndex; // What's selected
var total = document.getElementById('total1');
total.value = prices[sel[ind].value]; // the correlating value from the array
if (ind == 0) { return; }
if (submit_it) { form.submit(); }
}
</script>I hope this all makes sence!
Cheers
Wardy