Evertjan. said on 05/04/2006 7:13 AM AEST:
wrote on 04 apr 2006 in comp.lang.javascript:
If you want answers on usenet, you should try to comply with Netiquette,
and quote relevant part of the posting you are answering on.
As I answered you this is quite possible with google.groups to,
though using a dedicated news-client makes using usenet much easier and
nicer for you.
===========
You can identify the next <td> in a <tr> by doing some clever id-ing:
<td id='r1c1'></td><td id='r1c2'></td>
Or you can try using the DOM to point to the next cell.
One-of:
<table>
<tr>
<td onmouseover="
var o;
(o = this.parentNode.cells[this.cellIndex+1])
&& (o.style.backgroundColor='red');
" onmouseout="
var o;
(o = this.parentNode.cells[this.cellIndex+1])
&& (o.style.backgroundColor='white');
">Cell 0</td>
<td>Cell 1</td>
</tr>
</table>
In general:
<table id="TableA">
<tr>
<td>Cell</td>
<td>cell</td>
<td>cell</td>
<td>cell</td>
</tr>
<tr>
<td>Cell</td>
<td>cell</td>
<td>cell</td>
<td>cell</td>
</tr>
</table>
<script type="text/javascript">
function nextHi()
{
var o;
(o = this.parentNode.cells[this.cellIndex+1])
&& (o.style.backgroundColor='red');
}
function nextLo()
{
var o;
(o = this.parentNode.cells[this.cellIndex+1])
&& (o.style.backgroundColor='white');
}
window.onload = function(){
var t, tds;
if ( document.getElementById
&& (t = document.getElementById('TableA'))
&& t.getElementsByTagName
&& (tds = t.getElementsByTagName('td'))){
var i = tds.length;
while (i--){
tds
.onmouseover = nextHi;
tds.onmouseout = nextLo;
}
}
}
</script>