damindor Posted February 26, 2014 Share Posted February 26, 2014 so far nothing out of my new book works I am stryggling wiht getting a multi dimensinal array to work here is the code <script language=?JavaScript? type=?text/javascript?> var personnel = new Array(); personnel[0] = new Array(); personnel[0][0] = ?Name0?; personnel[0][1] = ?Age0?; personnel[0][2] = ?Address0?; personnel[1] = new Array(); personnel[1][0] = ?Name1?; personnel[1][1] = ?Age1?; personnel[1][2] = ?Address1?; personnel[2] = new Array(); personnel[2][0] = ?Name2?; personnel[2][1] = ?Age2?; personnel[2][2] = ?Address2?; document.write(?Name : ? + personnel[1][0] + ?<BR>?); document.write(?Age : ? + personnel[1][1] + ?<BR>?); document.write(?Address : ? + personnel[1][2]); </script> Link to comment Share on other sites More sharing options...
0 Top Qat Posted February 26, 2014 Share Posted February 26, 2014 Works for me. Here is my cleaned up version: <script language="JavaScript" type="text/javascript"> var personnel = [["Name0", "Age0", "Address0"], ["Name1", "Age1", "Address1"], ["Name2", "Age2", "Address2"]] document.write("Name : " + personnel[1][0] + "<BR>"); document.write("Age : " + personnel[1][1] + "<BR>"); document.write("Address : " + personnel[1][2]); </script> I did notice something odd about the quotes when I did copy'n'paste. Check your character set to make sure you are using the correct double quote ("). Link to comment Share on other sites More sharing options...
0 soil Posted February 26, 2014 Share Posted February 26, 2014 Why not use javascript objects? http://www.w3schools.com/js/js_objects.asp Link to comment Share on other sites More sharing options...
0 +virtorio MVC Posted February 26, 2014 MVC Share Posted February 26, 2014 The code you posted has curly quotes, not standard quote characters; this is common when copying code out of ebooks and programs like Microsoft Word. edit: opps, didn't notice Top Qat above already mentioned that. Link to comment Share on other sites More sharing options...
Question
damindor
so far nothing out of my new book works I am stryggling wiht getting a multi dimensinal array to work here is the code
Link to comment
Share on other sites
3 answers to this question
Recommended Posts