Results 1 to 9 of 9

Thread: multi-dimensional array mystery - javascript (solved but may be of interest)

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member progressive's Avatar
    Join Date
    Sep 2001
    Location
    Manchester, UK
    Posts
    404

    multi-dimensional array mystery - javascript (solved but may be of interest)

    Try the below script, it works as it should adding 'hello' to each
    element of the array in turn.

    Until it reaches element [2][0].
    then it throws an 'object expected' error..*sighs deeply* am i
    missing something blatantly obvious here can someone please
    enlighten me?

    Code:
    <html>
    <head>
    </head>
    <script>
    var board_pos = new Array(new Array(), new Array());
    
    	for(a = 0; a <= 5; a++)
    	{
    		for(b = 0; b <= 6; b++)
    		{
    			alert (a + ' , ' + b);
    			board_pos[a][b] = 'hello';
    		}
    	}
    </script>
    <body>
    </body>
    </html>
    Last edited by progressive; May 20th, 2002 at 06:59 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width