Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Transparent "mouseOut" state for cell-color-change rollover?

Status
Not open for further replies.

solomania9

Technical User
Sep 23, 2001
7
US
I know that I can use a transparent gif and some image swapping to acheive this, but I'd really like to use cell colors to conserve bandwidth.

So far, I have this:

<SCRIPT language=JavaScript>
<!--
function over(c)
{
c.style.backgroundColor='#990000';
}
function out(c)
{
c.style.backgroundColor='#000000';
}
// -->
</SCRIPT>

...

<td onmouseout=out(this); onmouseover=over(this);>Cell</td>

...

But the problem with this (as you can see) is that the &quot;out&quot; state is black. Is there any way to make it transparent? I suppose I could do some &quot;document.write&quot; stuff to define the td attrubutes, but I'd rather not get involved with that because my Javascript is a bit shoddy.

Thanks for the help!

~Mike
 
try setting it to nothing - but I am pretty sure it will assume the color of the table - if there is one defined.

Leave out the bgColor for the table - and use

c.style.backgroundColor='';

should give you transparent cell.
 
Or you can give the the transparent value......

c.style.backgroundColor = 'transparent';
===
Supports Mozilla and Web Standards
Knows HTML/XHTML, CSS1, JavaScript, PHP, C++, DOM1
===
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top