Not sure if this is what you are going for, but I personally prefer to use
an array of custom JS objects for simulating multi-dimensional arrays:
eg. Imagine a case where you wanted to store in an array, a URL and the text
to display for each URL. I'd start by creating a really simple JS object:
function URL( url, name ) {
this.url = url;
this.name = name;
}
Then you can simply store each object in an 'array of objects':
var myURLs = new Array();
myURLs[0] = new URL ( 'www.yahoo.com', 'Yahoo!' );
myURLs[1] = new URL ( 'www.sitepoint.com', 'Site Point' );
myURLs[3] = new URL ( 'www.cnn.com', 'CNN' );
myURLs[4] = new URL ( 'www.espn.com', 'espn' );
Then you can just access each one via the object properties. Eg. to get the
data for the second value:
url = myUrls[1].url
name = myUrls[1].name
I find that the inherent structure of a custom object approach makes it a
lot easier to manage things - both in developing the code and whenever I
need to revisit it later on to make any changes or extend it in any way.
This is my personal preference anyway.
Apologies in advance if this is confusing or off-topic!
"Keiron Waites" <we*******@NOSPAMsharemonkey.com> wrote in message
news:bn**********@sparta.btinternet.com...
<script language="JavaScript" type="text/javascript">
<!--
var array1 = new Array();
var array1i = new Array();
array1[0] = array1i["hello"];
alert(array1[0][0]);
// -->
</script>
Why doesn't this work?
Thanks.