Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
JavaScript array multidimensional 
 

In this Tutorial we want to describe you a code that help you in understanding JavaScript array multidimensional.

 

JavaScript array multidimensional

                         

In this Tutorial we want to describe you a code that help you in understanding JavaScript array multidimensional. For this we are using JavaScript language, This code illustrate a multidimensional array application used in creating a table. The document. write create a table with 4 columns and 4 rows with a different field name of the  column. 

In this code we consider a function multidimensional array that accept table as argument .Inside this function we print a table showing you 'Example to show Multidimensional Array' and print the name of respective columns. The for loop execute the script till the variable x is less than equal to 3.The document. write print the number of columns. In the same way the for loop execute the script and print the number of  rows till variable y is less than equal to 2.The var array instantiate an array object and store the value passed as parameter to it. The var new array instantiate the array object by accepting the arrays object as parameter. Finally a new multidimensional table is created and show the list of different value in the respective column.

 

 

 

JavascriptMultidimensionalArray.html

<html>
    <head>
        <title>JavaScript Multidimensional Array</title>
        <script language="JavaScript" type="text/javascript">

            function multidimensionalArray(table) {
                document.write("<b>Example to show 
                MultiDimensional Array</b>"
+"<br>");
                document.write("<table border=1>");     
                document.write("<th>S.no</th><th>Name</th><th>Ph.No</th>\n\
                     <th>Company</th>");
                for(var x=1; x<=3; x++) {
                    document.write("<tr><td>",x,"</td>");
                    for(var y=0; y<=2; y++){
                        document.write("<td>",table[x][y],"</td>");
                    }
                    document.write("</tr>");
                }
                document.write("</table>");
            }
            var array1 = new Array("Girish","971999","Roseindia.net");
            var  array2 = new Array("Mahendra","971988","Roseindia.net");
            var  array3 = new Array("Komal","971977","Roseindia.net");
            var newarray = new Array("",array1,array2,array3);

            multidimensionalArray(newarray);
        </script>
    </head>
    <body>
     </body>
</html>

Output of the program

Download Source code

                         

» View all related tutorials
Related Tags: java javascript c string oop array ant function script object diff fun io include help load variable sed print loop

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.