Posted by google on 02/25/06 01:34
Dave Smithz wrote:
> I want to change the CSS style sheet applied to a table cell when the mouse
> moves over it. But I am not sure how to do it.
This is some code that should work for changing the background color of
a cell when hovering over it:
<head>
<script type="text/javascript">
function hl(source){
if (source.className == 'style-1') {
source.className = 'style-2';
} else if (source.className == 'style-2') {
source.className = 'style-1';
}
}
</script>
<style>
.style-1 {
background-color:white;
}
.style-2 {
background-color:blue;
}
</style>
</head>
<body>
<table>
<tr>
<td onMouseOver="hl(this);" onMouseOut="hl(this);">This is the cell
that will change color</td>
</tr>
</table>
</body>
Chris S.
Implied By Design LLC.
http://www.impliedbydesign.com
Free Web Design Tools
http://www.impliedbydesign.com/free-software-scripts.html
[Back to original message]
|