Return to Snippet

Revision: 7388
at July 24, 2008 11:07 by jamesming


Updated Code
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);
	}

Revision: 7387
at July 24, 2008 11:05 by jamesming


Updated Code
var sDataArray=MultiDimensionalArray(7,2);
		
sDataArray[6][1] = "This has been stored successfully!";
		
alert(sDataArray[6][1]);
		
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);
}




// THREE DIMENSIONS

	function MultiDimensionalArray(iRows,iCols,iDepth)
	{
	var i;
	var j;
	var m;
	   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] = new Array(iDepth);
	           for (m=0; m < iDepth; m++)
	           {
	           	a[i][j][m] = "";
	           }
	       }
	   }
	   return(a);
	}

Revision: 7386
at July 21, 2008 10:35 by jamesming


Updated Code
var sDataArray=MultiDimensionalArray(7,2);
		
sDataArray[6][1] = "This has been stored successfully!";
		
alert(sDataArray[6][1]);
		
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);
}

Revision: 7385
at July 21, 2008 10:35 by jamesming


Initial Code
var sDataArray=MultiDimensionalArray(7,2);
		
		sDataArray[6][1] = "This has been stored successfully!";
		
		alert(sDataArray[6][1]);
		
		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);
		}

Initial URL
http://www.developerfusion.co.uk/show/2310/

Initial Description

                                

Initial Title
Multidimensional Array

Initial Tags
array

Initial Language
JavaScript