Click to See Complete Forum and Search --> : NS/IE problems with mouseover script


quigleyb
05-09-2003, 08:55 AM
Hi,

im using a small javascript for a mouseover. It works in IE, but not netscape. Can anyone help me fix it ? The code is to change the background colour of the cell which the link is in. The code is below...

[function....]
<SCRIPT language=JavaScript type=text/javascript>
function cellBgColor(etr,clr) {
document.all[etr].style.backgroundColor=clr;
}
</SCRIPT>

[table code.....]
<tr>
<td id="c4" style="padding:3px; border-width:1px; border-color:#FFFFFF; border-style:solid; background-color:#ffffff;
onMouseOut="cellBgColor('c4','ffffff');"
onMouseOver="cellBgColor('c4','FFC4C5');">Portfolio
<td>
</tr>

Jona
05-09-2003, 08:59 AM
Use this:

document.getElementById(etr).style.backgroundColor=clr;

instead of what you have:

document.all[etr].style.backgroundColor=clr;