Library code snippets
Building a MultiDimensional Array in Javascript
By David Nishimoto, published on 06 May 2002
Building a MultiDimensional Array in Javascript The MultiDimensional Array
is zero based. In the following example the array range is [0..6][0..1].
Implementation:
var sDataArray=MultiDimensionalArray(7,2);
alert(sDataArray[0][0]);
Code
function MultiDimensionalArray(iRows,iCols)
{
var i;
var j;
var a = new Array(iRows);
for (i=0; i < iRows; i++)
{
a[i] = new Array(iCols);
for (j=0; j < iCols; j++)
{
a[i][j] = "";
}
}
return(a);
}
Related articles
Related discussion
-
VB.NET: Hide and show table using radio buttons
by converter2009 (1 replies)
-
Java Script, File uploading on ftp server using java script code
by h_c_a_andersen (2 replies)
-
.NET Developer in Ghana Required....
by sysview (0 replies)
-
Creating IFrame through javascript.
by cse_gurpreet (3 replies)
-
How to get unique Bytes from a String ?
by FarhanBajwa (0 replies)
Related podcasts
-
The Future of .NET Dotfuscator with Gabriel Torok
Keith and Woody sat down with PreEmptive President Gabriel Torok to discuss the news that Microsoft is including PreEmptive's Dotfuscator Community Edition in Visual Studio 2010. The guys also discussed how Dotfuscator can be used to assist with Feature Monitoring, Usage Expiry, and Tamper ...
Events coming up
-
Dec
15
Portland Java User Group
Portland, United States
This month's topic: TBD----------PJUG meetings start with eat+meet+greet time (pizza and beverages are provided), followed by the featured speaker, then some time for Q&A, discussion, and sometimes a drawing to give away swag. :)It is...
Hello,
I 'ld like to know how you can fill such a multidimensional array with a recordset from a MySQL database.
I can fill a selectbox with a query result with PHP.
Now what I want to do is make a selection in one selectbox that reflects on the option in the other select-box.
as seen on this page!
All need to know is how I can get the associative multidimensional PHP-array (the query-result) in the multidimensional JS-array to fill the select-boxes.
I suppose I can loop through the JS-array and fill in the PHP-values when the page loads.
I'll post the code if I find a solution.
I hope someone can give me some tips.
This thread is for discussions of Building a MultiDimensional Array in Javascript.