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
-
Getting Culture Information through Javascript
by kishorrudra (5 replies)
-
How to assign a value to hidden field using javascript in asp.net
by Freon22 (8 replies)
-
(Very urgent)how to assign the value of the variable in javascript function into php variable
by mazhar_qayyum (3 replies)
-
Add a JavaScript popup to an ASP.NET button
by jessics (9 replies)
-
Free download javascript ebooks
by annliu (1 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
-
Oct
28
Web Standards Group (Sydney)
North Sydney, Australia
TBA
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.