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!

Rolover to transparent background

Status
Not open for further replies.

solomania9

Technical User
Sep 23, 2001
7
US
Hi All,

I'm making a navigation table, and when a user rolls over a cell, it turns red and when they roll off, it turns transparent again (so they can see the image underneath).

My code works fine, except in old versions of netscape, it doesn't recognize c.style.backgroundColor=''; as transparent. So, here's the script I currently have in the head:

function over(c)
{
c.style.backgroundColor='#990000';
}

function out(c)
{
c.style.backgroundColor='';

I'd like to have the "out" function call up a transparent gif as the background. How do I do this? I really don't know much about javascript.

Thanks for your help,
Mike
 
well, to answer your question:

function out(c){
c.style.backgroundImage="url('transparent.gif')";
}

but I dont think that will help you, since the reason your code isnt working is because older versions of netscape dont recognize stylesheets, which is what you are manipulating. Robert Carpenter
questions? comments? thanks? email me!
linkemapx@hotmail.com
Icq: 124408594
online.dll

AIM & MSN: robacarp
 
Thanks theEclipse, it worked great. But you mentioned my problem is with older browsers not recognizing style sheets - is there any other way of doing cell rollovers atop an image bg? (Without using Fireworks or Imageready...)

Thanks,
~Mike
 
well, older browsers dont support the onmouseover for anything but a link, either, so:

<td>
<a href=&quot;#&quot; onmouseover=&quot;document.tdImg.src='redBack.gif';&quot; onmouseout=&quot;document.tdImg.src='transBack.gif';&quot; onclick=&quot;return false;&quot;>
<img src=&quot;transBack.gif&quot; name=tdImg width=100% height=100%></a>
</td>

Robert Carpenter
questions? comments? thanks? email me!
linkemapx@hotmail.com
Icq: 124408594
online.dll

AIM & MSN: robacarp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top