Jump to content

Recommended Posts

I have this code and it works when the mouse goes over but it doesn't work when the mouse moves off of it. The code is below, any help would be great!

 

 

<td bgcolor="#FF9900" valign="top" style="border: 2px solid #00003B" onmouseover="style.backgroundImage='url(hover-bg.jpg)'" onmouseout="style.backgroundColor='#00003B'">

Link to comment
https://forums.phpfreaks.com/topic/36786-onmouseout/
Share on other sites

Without knowing more than the info you supply, my best guess would be : because your background-image is on top of your background.

 

<td bgcolor="#FF9900" valign="top" style="border: 2px solid #00003B" onmouseover="style.backgroundImage='url(hover-bg.jpg)'" onmouseout="style.backgroundImage='none';style.backgroundColor='#00003B'">

 

btw you should use this.style for browser compatibility, and also end your inline javascript with semicolon, just like you usually would in js. Same in inline css.

 

<td bgcolor="#FF9900;" valign="top" style="border: 2px solid #00003B;" onmouseover="this.style.backgroundImage='url(hover-bg.jpg)';" onmouseout="this.style.backgroundImage='none';this.style.backgroundColor='#00003B';">

Link to comment
https://forums.phpfreaks.com/topic/36786-onmouseout/#findComment-177107
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.