Breeze
12-28-2003, 01:53 PM
I have a simple script to grab the quantity of an item ordered, multiply it by the price, and then display the total.
var qty1 = document.form.Qty1.value;
var price1 = document.form.Price1.value;
cost1 = (qty1 * price1);
document.form.total1.value=cost1;
var qty2 = document.form.Qty2.value;
var price2 = document.form.Price2.value;
cost2 = (qty2 * price2);
document.form.total2.value=cost2;
But I have lots of items so want to do some kind of loop rather than writing these lines over and over. Thanks.
var qty1 = document.form.Qty1.value;
var price1 = document.form.Price1.value;
cost1 = (qty1 * price1);
document.form.total1.value=cost1;
var qty2 = document.form.Qty2.value;
var price2 = document.form.Price2.value;
cost2 = (qty2 * price2);
document.form.total2.value=cost2;
But I have lots of items so want to do some kind of loop rather than writing these lines over and over. Thanks.