faqts : Computers : Internet : Web : HTML

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

33 of 59 people (56%) answered Yes
Recently 2 of 10 people (20%) answered Yes

Entry

How can I change link color and bgcolor of table cell at the same time when mouse's over cell only?

Apr 29th, 2003 09:25
Will S., Ben Gordon, me mez,


You could try the solution listed here
http://faqts.com/knowledge_base/view.phtml/aid/10642/fid/55
  or you could create 2 classes like this
<style>
<!--
.off {color: green; background-color: red; layer-background-color: red;}
.on {color: red; background-color: yellow; layer-background-color: 
yellow;}
-->
</style>
then assign the classes to a onMouseover & onMouseout event something
like this
<html>
<head>
	<title>Dynamic Background Change</title>
	
	<style>
	<!--
	.off {color: green; background-color: red; layer-background-
color: red;}
	.on {color: red; background-color: yellow; layer-background-
color: yellow;}
	-->
</style>
</head>
<body>
<table>
<tr>
<td><a href="null">somewhere.com</a></td>
<tr><td onMouseover="this.className='on'"
onMouseout="this.className='off'" class="off"><a href="stuff.com">Get
Stuff</a></td></tr></tr></table>
</body>
</html>

either solution should work fine in IE or NS 6

Entered by Will S.:
You can also use the onMouseover, etc code in the <tr> tag to highlight 
the whole row.

eg:
...
<tr onMouseover="this.className='on'" onMouseout="this.className='off'" 
class="off">
...