hi A standard array has rows (x) and columns (y) there for it 2d ;-) I know, I know... that is how they refer to array dimensions your right that it was a 2d array.
It is really multi-dimensional arrays we are dealing with to take it to the next dimension you need to create an array of arrays of arrays try this <script language="JavaScript" type="text/javascript"> <!-- var array10=new Array(); var array11=new Array(); var array20=new Array(); var array21=new Array(); var array30=new Array(); var array31=new Array(); var arrayd1=new Array(array10, array11); var arrayd2=new Array(array20, array21); var arrayd3=new Array(array30, array31); var array3d=new Array(arrayd1, arrayd2, arrayd3); array3d[0][0][0]=1; alert(array3d[0][0][0]); // --> </script> Ben Johansen - http://www.pcforge.com Authorized WiTango Reseller http://www.pcforge.com/WitangoGoodies.htm latest beta downloads @ http://www.witango.ws -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Chan, Monte IT Sent: Friday, June 28, 2002 5:42 PM To: Multiple recipients of list witango-talk Subject: RE: Witango-Talk: Javascript -- 3D arrays (Super OT) 3darray[x][y] is 2d not 3d though. 3-d array would be something like this 3darray[x][y][z] I have tried this, var array1=new Array(); var array2=new Array(); var array3=new Array(array1, array2); array3[0][0]=1; alert(array3[0][0]); And then I could assign values to array3 and it worked as expected. However, when I tried the following: var array0=new Array(); var array1=new Array(); var array2=new Array(); var array3=new Array(array0, array1, array2); array3[0][0][0]=1; alert(array3[0][0][0]); it gave me an error saying that line 6: array3.0.0 is null or not an object. ------------------------------------ http://www.mvphealthcare.com Monte Chan Senior Programmer, IT Mailing Address: MVP Health Care 625 State Street PO Box 2207 Schenectady, NY 12301 Physical Address: (for UPS, Fedex, Airborne etc) MVP Health Care 625 State Street Schenectady, NY 12305 Phone: (518) 386-7564 Email: [EMAIL PROTECTED] -----Original Message----- From: Ben Johansen [mailto:[EMAIL PROTECTED]] Sent: Friday, June 28, 2002 7:57 PM To: Multiple recipients of list witango-talk Subject: RE: Witango-Talk: Javascript -- 3D arrays (Super OT) Hi You setup the array with the elements being arrays Ar1 = new Array("A","B","C"); Ar2 = new Array("1","2","3"); Ar3 = new Array(100,200,300); 3darray = new Array("",Ar1,Ar2,Ar3); get data the following: 3darray[x][y] example 3darray[2][3] = "3" Ben Johansen - http://www.pcforge.com Authorized Witango Reseller http://www.pcforge.com/WitangoGoodies.htm Latest downloads & List Archives @ http://www.witango.ws -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Chan, Monte IT Sent: Friday, June 28, 2002 4:38 PM To: Multiple recipients of list witango-talk Subject: Witango-Talk: Javascript -- 3D arrays (Super OT) This is a very simple question but I just cannot think right now. To have a one-d array, I would do the following: var myArray = new Array(); And then I can assign values to myArray. But what if I want to declare a three-d array, how am I supposed to declare that? Thanks, Monte ------------------------------------ http://www.mvphealthcare.com Monte Chan Senior Programmer, IT Mailing Address: MVP Health Care 625 State Street PO Box 2207 Schenectady, NY 12301 Physical Address: (for UPS, Fedex, Airborne etc) MVP Health Care 625 State Street Schenectady, NY 12305 Phone: (518) 386-7564 Email: [EMAIL PROTECTED] ________________________________________________________________________ TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED] with unsubscribe witango-talk in the message body ________________________________________________________________________ TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED] with unsubscribe witango-talk in the message body ________________________________________________________________________ TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED] with unsubscribe witango-talk in the message body ________________________________________________________________________ TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED] with unsubscribe witango-talk in the message body
