PDA

View Full Version : onmouseover/onmouseout


marringi
05-22-2008, 03:26 PM
I want to use this on my page:

<td onmouseover="style.backgroundColor=#990000" onmouseout="style.backgroundColor=#003366">

But I do not want to write the color of the onmouseout (#003366). I'm looking for some script to change the color back to the original color (#990000) when the mouse moves away from the cell.

Is this possible?

kadm
05-22-2008, 09:08 PM
First you should wrap the color definition between single quotes ('')

Then, leave the quotes for the onmouseout empty, so it takes the default color onmouseout.

<td onmouseover="style.backgroundColor='#990000'" onmouseout="style.backgroundColor=''">

marringi
05-22-2008, 11:08 PM
hey it's that simple.

thanks man