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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Want to change table background IMAGE onMouseOver or OnClick, etc. 1

Status
Not open for further replies.

jonnyGURU

IS-IT--Management
Aug 19, 2004
138
US
Ok... This works:

<td onClick="this.bgColor='#DDDDDD'">

Or this...

<td onMouseOver="this.bgColor='#DDDDDD'">

Whatever floats your boat.

I want to change the background image, though.

Since this works:

<td background="image.jpg">

I figured this would work:

<td onMouseOver="this.background='image.jpg'">

It doesn't. So I tried defining a style like this:

<td style='background: url(image.jpg);'">

Which works, but when I try to make it work with an event handler the way bgcolor works, it doesn't work. What I have is this:

<td onMouseover="this.style='background: url(image.jpg);'">

What the heck am I doing wrong? Is javaScript simpy not able to manipulate images like it does colors?

Dispensing quality rants and mishaps since 1999:
 
Code:
<td style="background-image: url([URL unfurl="true"]http://www.tek-tips.com/images/partnerbtn120x60.gif)"[/URL] 

onmouseover="this.style.backgroundImage = 'url([URL unfurl="true"]http://www.tek-tips.com/images/logo.gif)'">[/URL]

*cLFlaVA
----------------------------
[tt]Sigs cause cancer.[/tt]
 
try something like
Code:
<td onmouseout="background='URL'" onmouseover="background='URL'">

That Should also work
 
Thanks cLFlaVA. That worked like a charm.

Extreme43: I would think that would work, but it doesn't. :(

Dispensing quality rants and mishaps since 1999:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top