/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var sDataArray=MultiDimensionalArray(7,2); sDataArray[6][1] = "This has been stored successfully!"; alert(sDataArray[6][1]); function MultiDimensionalArray(iRows,iCols) { var a = new Array(iRows); for (var i=0; i < iRows; i++) { a[i] = new Array(iCols); for (var j=0; j < iCols; j++) { a[i][j] = ""; } } return(a); } // THREE DIMENSIONS function MultiDimensionalArray(iRows,iCols,iDepth) { var a = new Array(iRows); for (var i=0; i < iRows; i++) { a[i] = new Array(iCols); for (var j=0; j < iCols; j++) { a[i][j] = new Array(iDepth); for (var m=0; m < iDepth; m++) { a[i][j][m] = ""; } } } return(a); }
URL: http://www.developerfusion.co.uk/show/2310/