Forum Moderators: open
<table style="background-color:#fff;">
<tr>
<td id="cell1"><a href="#" onmouseover="hilite('cell1')">Highlight cell</a></td>
<td id="cell2"><a href="#" onmouseover="hilite('cell2')">Highlight cell</a></td>
<td id="cell3"><a href="#" onmouseover="hilite('cell3')">Highlight cell</a></td>
</tr>
</table>
<script>
function hilite(id) {
// clear colors
document.getElementById("cell1").style.backgroundColor = "#fff";
document.getElementById("cell1").style.backgroundColor = "#fff";
document.getElementById("cell1").style.backgroundColor = "#fff";
// highlight selected cell in red
document.getElementById(id).style.backgroundColor = "red";
}
</script>
hth,
g.
For a simple alternative, add a pair of styles to your style sheet:
.linkout {background-color: #fff;}
.linkover {background-color:#f00;}
Then change the style on mouseover and mouseout:
<table><tr>
<td onmouseover="this.className='linkover'" onmouseout="this.className='linkout'"><a href="#">cell 1</a><td>
<td onmouseover="this.className='linkover'" onmouseout="this.className='linkout'"><a href="#">cell 2</a><td>
<td onmouseover="this.className='linkover'" onmouseout="this.className='linkout'"><a href="#">cell 3</a></td>
</tr></table>