peterinwa
04-01-2003, 08:12 AM
I am going to have a lot of code like this:
// Function to set item
function setItem(n){
if (n==1){V=parent.image.document.formA.pro1.value}
if (n==2){V=parent.image.document.formA.pro2.value}
if (n==3){V=parent.image.document.formA.pro3.value}
if (n==4)...
}
So I am wondering if I can shorten it by simply having the variable "n" which is handed to the function replace the number digit in "pro"
Something like this:
// Function to set item
function setItem(n){
V=parent.image.document.formA.pro[n].value;
}
I'm sure the answer's really easy or it's not possible. Thanks in advance!
Peter
// Function to set item
function setItem(n){
if (n==1){V=parent.image.document.formA.pro1.value}
if (n==2){V=parent.image.document.formA.pro2.value}
if (n==3){V=parent.image.document.formA.pro3.value}
if (n==4)...
}
So I am wondering if I can shorten it by simply having the variable "n" which is handed to the function replace the number digit in "pro"
Something like this:
// Function to set item
function setItem(n){
V=parent.image.document.formA.pro[n].value;
}
I'm sure the answer's really easy or it's not possible. Thanks in advance!
Peter