|
more array variables
Can anybody help me with defining variables with in a inner.HTML function et al that will change the name of the array:
i.e.
I have 2 arrays which are defined as follows
var prod= new array(10);
var clr= new array(10);
and let say...
prod[1]="$45";
prod[2]= "$85";
clr[1]="Red";
clr[2]="Blue";
I'd like to control the innerhtml function by using 2 variables say x and i.
for (i=1; i <= 2; i++) {
if (document.getElementById) {
document.getElementById(i).innerHTML = (x[i]);
x = x + 1;
}
}
.....
How can I get x[i] to actually represent the array value?
Thanks,
Rich
|