I need a multidimentional array. Javascript does not support multidimentional arrays. got a solution? I need this for a dropdown menu: submenustrings [ menu ] [ item ] [ item values ] this has been annoying the hell out of me for ages now -- I might even have to resort to placing some VBscript in my webbitty site.
I did when I was posting, but had problems using it. Its all fixed now, however -- its a shame multidimentional arrays have to be done is such a confusingly complicated way; its moronic.
so are a lot of high-level languages, cobol or camel for instance. or the brackets in VB () been the same for functions as they are arrays, nice.
Just caught this... 'tis true that Javascript does nto support multidimensional arrays (boo!) but you can use object to get arround this as implied by batsman At the end of the day a JS Array is just an object so you can use that knowledge. When an Array is created it really creates an object based on the given arguments. here's a very simple 2D array: // declare an array var arrUserPassword = new Array(10); // define what our array will hold function UserDetails(name, pwd) { this.name = name; this.pwd = pwd } //add items arrUserPassword[0] = new UserDetails("Admin", "god") arrUserPassword[1] = new UserDetails("Stu", "muppet") To turn this into a 3d array I could just create another object which could be an array.... // define what our array will hold function UserDetails(name, pwd, history) { this.name = name; this.pwd = pwd this.history = history } var pwdhist = new Array("a", "b", "c"); //add items arrUserPassword[0] = new UserDetails("Admin", "god", pwdHist) You can then use accessor functions via the prototype keyword to retrieve items from the 3d dimension P.S This is written from memory and might [not] work - but it might help for future stuff/info