Code:
<td onmousemove="style.backgroundColor = 'white';"document.getElementById('test').style.backgroundColor = 'white';">
The highlighted should be:
this.style.backgroundColor
And what element has the ID test?
[edit]
If I understand what you want, I think this should work:
Code:
<script type="text/javascript">
var trRows = function(e){
var el = document.getElementById(e);
var tr = el.getElementsByTagName('tr');
for(i=0,color=new Array();i<tr.length;++i){
tr[i]["onmouseover"] = function() { this.style.backgroundColor = "yellow"; };
tr[i]["onmouseout"] = function() { this.style.backgroundColor = "#FFF"; };
}
}
</script>
<table id="hovTable" border="1">
<tr><td>Array1</td><td>Dog</td><td>Cat</td><td>Horse</td></tr>
<tr><td>Array2</td><td>Ferrari</td><td>Mustang</td><td>Hummer</td></tr>
<tr><td>Array3</td><td>Clouds</td><td>Sun</td><td>Stars</td></tr>
<tr><td>Array4</td><td>Orange</td><td>Apple</td><td>Banana</td></tr>
</table>
<script type="text/javascript">
window.onload = trRows('hovTable');
</script>
Although if you give a tr a bg color, it won't return. If your giving your tr[s] bg colors that are different then all the other tr[s], then tell me and I'll make it happen.
Bookmarks