I am having trouble determining if the object is null or not an object. I tried using this line in an if condition to solve it, but it's not working.
However, I keep getting an ERROR message stating "object is null or not an object".
var preWynum = "";
function paint(Wynum)
{
// alert("Wynum:"+Wynum +", preWynum:"+preWynum);
if(document.getElementById(preWynum) && document.getElementById(Wynum))
{
document.getElementById(preWynum).style.backgroundColor='white';
document.getElementById(Wynum).style.backgroundColor='yellow';
}
preWynum = Wynum;
}
I'm puzzled as to why it's not running. Any other suggestions?
preWynum and Wynum represent the id of a table row (tr).
I am trying to set the background color of the currently selected row (which has the id of Wynum) to yellow.