document.onmouseover= function(event) {
if (event===undefined) event= window.event;
var target= 'target' in event? event.target : event.srcElement;
if(target.tagName == 'TR') {
target.style.backgroundColor = 'red';
}else{
target.style.backgroundColor = "yellow";
}
};
document.onmouseout= function(event) {
if (event===undefined) event= window.event;
var target= 'target' in event? event.target : event.srcElement;
target.style.backgroundColor = "transparent";
};
TR elements never highlight nor does onmouseover event fire for this. TD elements work fine. What explains this behavior and how can I make onmouseover fire when it touches TR element?
How about changing your code to:
Demo: http://jsfiddle.net/Asv4v/3/