[SOLVED]Help on JavaScript "is null or not an object&qu
Posted: Thu Nov 04, 2004 10:59 pm
I am getting this error on Internet Explorer 6.0
Although I.E. is reporting a Javascript error, it works fine in highlighting the row that i just clicked on the checkbox. There are no Error warning when using Netscape or Firefox. Anyone know why?
Thank you in advance.
Regards
Mian
Code: Select all
Char: 3
Error: 'cb.checked' is null or not an object
Code: 0Code: Select all
<SCRIPT LANGUAGE="JavaScript">
function getElement(id)
{
if(document.all)
return document.allїid];
else
return document.getElementById(id);
}
function highlight(num)
{
cb = getElement('cb'+num);
row_cb = getElement('row'+num);
if(cb.checked == true)
row_cb.style.backgroundColor = "lightblue";
else
row_cb.style.backgroundColor = "white";
}
</SCRIPT>
<tr id="row0"><td><input id="cb0" type="checkbox" name="deletelistї0]" value=66 onClick="highlight('0')"></input></td></tr>
<tr id="row1"><td><input id="cb1" type="checkbox" name="deletelistї1]" value=64 onClick="highlight('1')"></input></td></tr>Regards
Mian