Rollover switch to transparent back in FF&NS

B

Bart Van der Donck

Hi,

I'm having a hard time trying to find out why the following lines don't
work in Firefox and Netscape. The idea is to change the colour of a
table row at onmouseover, and then put it back to the <body>'s original
background-image at onmouseout.

<html>

<head>
<script language="javascript">
function omo(it)
{ it.bgColor='#FFFFCC'; }
function omout(it)
{ it.bgColor='transparent'; }
</script>
</head>

<body background="http://www.google.com/images/hp0.gif">
<table border="1">
<tr onmouseover="omo(this)"
onmouseout="omout(this)">
<td class="c1">sometext</td>
<td class="c2">moretext</td>
</tr>
</table>
</body>

</html>

Obviously, the actual javascript works fine in all browsers. It's only
the assignment of

it.bgColor='transparent';

that results in a blue background in NS/FF. In IE6 it works fine.

Any workarounds ?

Thanks,
 
M

Martin Honnen

Bart said:
function omo(it)
{ it.bgColor='#FFFFCC'; }
if (it && it.style) {
it.style.backgroundColor = '#FFFFCC';
}
function omout(it)
{ it.bgColor='transparent'; }

if (it && it.style) {
it.style.backgroundColor = '';
}
should do.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top