TypeError document.getElementByID() … is null?

mommyandbaby

New Member
Can anyone tell me why I might be getting this error?\[quote\] "TypeError: document.getElementById(...) is null @ line:25"\[/quote\]I am using JavaScript and this is what I have so far inside my \[code\]<script>\[/code\] tags...\[code\]var initBoard = new Array(new Array(0, 0, 0, 1), new Array(0, 0, 0, 0), new Array(3, 0, 0, 0), new Array(0, 0, 2, 0));function insertData(){for(var i = 0; i < 4; i++){ for(var j = 0; j <4; j++){ document.getElementById(i.j).innerHTML = initBoard[j]; }}}\[/code\]Below that inside my HTML \[code\]<body>\[/code\] I have this.... \[code\]<table border="2" ><tr align="center"><td><div id="00">0</div></td><td><div id="01">0</div></td><td><div id="02">0</div></td><td><div id="03">0</div></td></tr><tr align="center"><td><div id="10">0</div></td><td><div id="11">0</div></td><td><div id="12">0</div></td><td><div id="13">0</div></td></tr><tr align="center"><td><div id="20">0</div></td><td><div id="21">0</div></td><td><div id="22">0</div></td><td><div id="23">0</div></td></tr><tr align="center"><td><div id="30">0</div></td><td><div id="31">0</div></td><td><div id="32">0</div></td><td><div id="33">0</div></td></tr>\[/code\]When I try and run this I get that error from above.I have also tried to just hardcode the "ID" as \[code\]'00'\[/code\] or \[code\]'01'\[/code\] and it still gives me the same error message. Does anyone know what I am doing wrong? I have looked all over the place and everywhere says basically the same thing and it should be easy, but I cannot get past this.EDIT: Line 25 is \[code\]document.getElementById(i.j).innerHTML = initBoard[j];\[/code\]
 
Back
Top