G
Guest
I am using one of these two dimensional arrays
mun=new Array()
mun[1] = new detail("58","89","896")
mun[2] = new detail("54","25","457")
function detail(ara,grp,nme){
this.ara = ara
this.grp = grp
this.nme = nme
}
from the above we can see that the followinng line
mun[2].grp
will return "25"
As there are several tables with multiple arrays I need to refer to
these through other variables
I can do it by using the eval function as in in the following few
lines.
var rng = 'mun'
var iv = '2'
eval(rng + '[' + iv + '].grp'))
how can I achieve the same without the "eval" function.
I have tried the following but this just returns a string
temp = mun + '[' + iv + ']'
alert (temp.grp)
returns "undefined"
and
temp = mun + '[' + iv + '].grp'
alert (temp)
returns the string "mun[2].grp"
mun=new Array()
mun[1] = new detail("58","89","896")
mun[2] = new detail("54","25","457")
function detail(ara,grp,nme){
this.ara = ara
this.grp = grp
this.nme = nme
}
from the above we can see that the followinng line
mun[2].grp
will return "25"
As there are several tables with multiple arrays I need to refer to
these through other variables
I can do it by using the eval function as in in the following few
lines.
var rng = 'mun'
var iv = '2'
eval(rng + '[' + iv + '].grp'))
how can I achieve the same without the "eval" function.
I have tried the following but this just returns a string
temp = mun + '[' + iv + ']'
alert (temp.grp)
returns "undefined"
and
temp = mun + '[' + iv + '].grp'
alert (temp)
returns the string "mun[2].grp"