shivboy
11-16-2002, 05:39 PM
Okay, i've been experimenting dynamically accessing a matrix of layers. Now, i wanted to create an array of the id's of the layers in the matrix. that would mean a two dimensional array. but instead of generating an array, it gives an error " Expected ;" at the line (bold line in the code below) im trying to generate an array with div id's. the layers r arranged like:
*************
*************
*************
and the div id's go like div1_1 where it means div[row]_[column]. so i give this nested for loop construct:
var oTh = new Array();
for (var i = 1; i <= 10; i++)
{
for (var j = 1; j <= 20; j++)
{
eval('oTh["'+i+'"]["'+j+'"]= "div'+i+'_'+j+'"');
}
}
in the <body>, the divs are created like:
<div id="div1_1">
</div>
<div id="div1_2">
</div>
<div id="div1_3">
</div>
<div id="div1_4">
</div>
but it doesnt work. why? please help me with this. any help is appreciated.
thanx,
shivboy
*************
*************
*************
and the div id's go like div1_1 where it means div[row]_[column]. so i give this nested for loop construct:
var oTh = new Array();
for (var i = 1; i <= 10; i++)
{
for (var j = 1; j <= 20; j++)
{
eval('oTh["'+i+'"]["'+j+'"]= "div'+i+'_'+j+'"');
}
}
in the <body>, the divs are created like:
<div id="div1_1">
</div>
<div id="div1_2">
</div>
<div id="div1_3">
</div>
<div id="div1_4">
</div>
but it doesnt work. why? please help me with this. any help is appreciated.
thanx,
shivboy