You are here: Re: Changing CSS style in use for <TD> using Javascript - How? « HTML « IT news, forums, messages
Re: Changing CSS style in use for <TD> using Javascript - How?

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация