I keep getting an error saying that m[i][j].clr is null or not an object. The code is below. Can anyone tell me what I am doing wrong?
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
<script language=”JavaScript”>
var rows = 10, cols = 10;
var maze;
function Tile(ch,clr)
{
this.ch = ch;
this.clr = clr;
}
maze = new Array(cols)
for (i=0;i<rows;i++)
{
for (j=0;j<cols;j++)
{
maze[i] = new Array()
maze[i][j] = new Tile(“*”,”blue”)
}
}
function DisplayMaze(m)
{
for (i=0;i<rows;i++)
{
for (j=0;j<cols;j++)
{
document.write(‘<font size=”-4″ color=”‘ + m[i][j].clr + ‘”>’)
document.write(m[i][j].ch)
document.write(‘<font>’)
}
document.write(‘<br/>’)
}
}
DisplayMaze(maze);
</script>
</head>
<body>
<table width=”100%” border=”0″ cellspacing=”0″ cellpadding=”0″>
<tr>
<td width=”78%” height=”584″> </td>
<td width=”22%”> </td>
</tr>
</table>
</body>
</html>