rsci
05-15-2003, 08:37 PM
Easy question but I can't find anything by searching...
I would like to use components of an array for variable names:
var fDs=new Array("D1","D2","D3");
for (i=0; i<fDs.length; i++) {
var fDs[i]=new reVal(fDs[i])
}
function reVal(name) {
this.name=name+".txt";
this.value=name;
}
In the above 'for' statement I would like to call fDs[i] and use it as a variable name, to be used as a prototype. So, later in the script I can call, for example:
document.write(D1.name);
Easy solution I just can't find it.
Thanks.
I would like to use components of an array for variable names:
var fDs=new Array("D1","D2","D3");
for (i=0; i<fDs.length; i++) {
var fDs[i]=new reVal(fDs[i])
}
function reVal(name) {
this.name=name+".txt";
this.value=name;
}
In the above 'for' statement I would like to call fDs[i] and use it as a variable name, to be used as a prototype. So, later in the script I can call, for example:
document.write(D1.name);
Easy solution I just can't find it.
Thanks.