holabr
03-18-2005, 04:36 PM
I have an ASP page that builds a form that has up to 20 occurances of purchase order input data. The text fields are qty1, qty2, qty3,...etc., price1, price2, price3,... ect and ext1, ext2, ext3,... etc. I have a simple JS that calculates the ext value on change of qty or price. The problem is I don't want to have 20 copies of basically the same script for the 20 line occurances. Is there a way to pass the index (1 to 20) to the script and build the form value names in the script to calculate the right line?
The script is as follows:
function calcext (form,index) {
form.ext.value = form.qty.value*form.price.value;
}
The question is, how do add the index value to the "ext", "qty" and "price" to become "ext1" or "ext2" etc.
As you can tell I am new to this and really appreciate your help.
The script is as follows:
function calcext (form,index) {
form.ext.value = form.qty.value*form.price.value;
}
The question is, how do add the index value to the "ext", "qty" and "price" to become "ext1" or "ext2" etc.
As you can tell I am new to this and really appreciate your help.