...

View Full Version : Simple TR background change



Booma
01-03-2008, 06:29 PM
Hello, I'm currently using this script to highlight the text within a whole row of a table on mouseOver.

What I'd like to do is change it so that the background color changes. I've tried 'this.style.backgroundcolor = "#e00000" ' but with no success.

Any help or tutorial suggestion would be a great help.

Many thanks
function highlightRows() {
if (!document.getElementsByTagName) return false;
var rows = document.getElementsByTagName("tr");
for (var i=0; i<rows.length; i++) {
rows[i].onmouseover = function() {
this.style.color = "#e00000";
}
rows[i].onmouseout = function() {
this.style.color = "#000000";
}
}
}
addLoadEvent(highlightRows);

tomws
01-03-2008, 07:29 PM
Picky javascript.

this.style.backgroundColor

Camel-case it.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum