Change Table's Background Color (onmouseover)

Ever wonder how to make the background color in a table row change, just by moving your mouse over it? Here's the code to use.

April 1, 2004 --

This question came in: "Well, this is great, and very informative. I wonder if there is a way to unset the background color. So that the color can be changed onmouseover and then the changes removed onmouseout. Useful when there is an image in the background..."

Here's how to do this:

1. Remove the bgcolor="#FFFFFF" (so that the table row will not have a background color, and thus allow people to see the image in the background). I'm assuming your background image is in the page and not in the table cell.

2. Change onMouseOut="this.style.backgroundColor='#FFFFFF'" to
onMouseOut="this.style.backgroundColor=''" (that's two apostrophes followed by the closing quotation mark). In other words, when the mouse leaves the cell, set the background color to NONE, to allow people to view the background image.
[ First posted on 11/25/2003 by Manuel Viloria ]





Get In Touch With Manuel Today

Manuel@Viloria.net

Copyright © 1996 - 2010 by Viloria.com All Rights Reserved.

Click for Free Tutorial



  Previous Entry
  Next Entry


Secondthoughts @ Viloria.com
"We Host at H4P because H4P is affordable,reliable,
and customer-friendly!"
-- Manuel Viloria


  Viloria.com
  About Manuel Viloria
  Secondthoughts
  Archives
  Angelhouser
  Contact Us
  Privacy Statement
  RSS Feed


  Google Reader