Priti wrote:
Will this work for multiple calls, say a mouseover I want to change the cell
I am in and 2 others, one to the left and 1 to the right?
Same principle, did you try modifying the code yourself? The 2nd table
column mouseover changes the background color of two different cells,
send the unique ID of any two cells to the function to change their bkg
colors. This works in my IE6, Netscape 7.1, Firefox 0.8. There may be a
more straightforward way to do this but I don't know what it would be.
function change2(position,id0,id1) {
var cell0=document.getElementById(id0);
var cell1=document.getElementById(id1);
if (position=='in') {
cell0.style.backgroundColor='#ffffff';
cell1.style.backgroundColor='#ffffff';
} else {
cell0.style.backgroundColor='#6699cc';
cell1.style.backgroundColor='#6699cc';
}
}
<table border="1" cellspacing="1" width="450" bgColor="#6699cc">
<tr>
<td width="90" id="a1" name="a1">a1</td>
<td width="90" id="a2" name="a2"
onMouseOver="this.bgColor='#993300';change2('in',' a1','a3');"
onMouseOut="this.bgColor='#6699cc';change2('out',' a1','a3')">a2</td>
<td width="90" id="a3" name="a3">a3</td>
<td width="90" id="a4" name="a4">a5</td>
</tr>
<tr>
<td width="90" id="b1" name="b1">b1</td>
<td width="90" id="b2" name="b2"
onMouseOver="this.bgColor='#993300';change2('in',' b1','b4')"
onMouseOut="this.bgColor='#6699cc';change2('out',' b1','b4')">b2</td>
<td width="90" id="b3" name="b3">b3</td>
<td width="90" id="b4" name="b4">b5</td>
</tr>
<tr>
<td width="90" id="c1" name="c1">c1</td>
<td width="90" id="c2" name="c2"
onMouseOver="this.bgColor='#993300';change2('in',' c1','c3')"
onMouseOut="this.bgColor='#6699cc';change2('out',' c1','c3')">c2</td>
<td width="90" id="c3" name="c3">c3</td>
<td width="90" id="c4" name="c4">c5</td>
</tr>
<tr>
<td width="90" id="d1" name="d1">d1</td>
<td width="90" id="d2" name="d2"
onMouseOver="this.bgColor='#993300';change2('in',' d1','d4')"
onMouseOut="this.bgColor='#6699cc';change2('out',' d1','d4')">d2</td>
<td width="90" id="d3" name="d3">d3</td>
<td width="90" id="d4" name="d4">d4</td>
</tr>
</table>
Mike