Looks correct for me.
One note.
You can initiate your array without parameter.
cords = new Array();
I actually never used it with parameter.
Oleg.
-----Original Message-----
From: David Gilden [mailto:dowda@c...]
Sent: April 05, 2002 11:34 AM
To: javascript
Subject: [javascript] Javascript Syntax / two dimensional arrays
Is the following Javascript syntax correct?
I want to use two variables i and j here in this loop.
(is the , or ; needed)
for (var i= 0 , j=1; i < cords.length; i++, j++){
obj = eval("document.all['bear"+j+"']" );
obj.style.left = cords[i][0];
obj.style.top= cords[i][1];
}
Also is this syntax correct to this two dimensional array?
cords = new Array(16); // do I need the number in the prens?
for (var i=0; i < cords.length; i++){
cords[i] = new Array(2);
}
cords[0][0]= 228;
cords[0][1]= 380;
cords[1][0]=124;
cords[1][1]= 470;
cords[2][0]=20;
cords[2][1]=380;
cords[3][0]=748;
cords[3][1]=470;
cords[4][0]=332;
cords[4][1]=470;
cords[5][0]=540;
cords[5][1]=470;
cords[6][0]=644;
cords[6][1]=380;
cords[7][0]=436;
cords[7][1]=380;
cords[8][0]=20;
cords[8][1]=470;
cords[9][0]=124;
cords[9][1]=380;
cords[10][0]=228;
cords[10][1]=470;
cords[11][0]=748;
cords[11][1]=380;
cords[12][0]=436;
cords[12][1]=470;
cords[13][0]=540;
cords[13][1]=380;
cords[14][0]=644;
cords[14][1]=470;
cords[15][0]=332;
cords[15][1]=380;
---end---
Thanks
Dave
====================================================
Cora Connection: Your West African Music Source
Resources, Recordings, Instruments & More!
<http://www.coraconnection.com/>
====================================================
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20