rovi
05-31-2005, 04:50 PM
Hi,
I have this javascript code that passes a value to a form field, but the form field name is variable and depends on the variable i.
if (i==2){
document.PAYamount_2.value=document.FINAL.SELSHIPPING.value;
}else if (i==3){
document.PAY.amount_3.value=document.FINAL.SELSHIPPING.value;
}else if (i==4){
document.PAY.amount_4.value=document.FINAL.SELSHIPPING.value;
How could I construct the form field such that I dont have to write the if else statements and just use variable (like:
document.PAY.amount_[i].value=document.FINAL.SELSHIPPING.value;)
Thanks!
I have this javascript code that passes a value to a form field, but the form field name is variable and depends on the variable i.
if (i==2){
document.PAYamount_2.value=document.FINAL.SELSHIPPING.value;
}else if (i==3){
document.PAY.amount_3.value=document.FINAL.SELSHIPPING.value;
}else if (i==4){
document.PAY.amount_4.value=document.FINAL.SELSHIPPING.value;
How could I construct the form field such that I dont have to write the if else statements and just use variable (like:
document.PAY.amount_[i].value=document.FINAL.SELSHIPPING.value;)
Thanks!