Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

table bg change on hover

Status
Not open for further replies.

defrex

Programmer
Aug 22, 2001
83
CA
i know this is posible, but for some reason my mind isn't working right and i can't think of how. so could somone tell me how to change the background color of a <td> tag on hover/onMouseOver? not knowing is an excuse for those umwilling to lern -- John Rueben
 
The only way to do it with css right now is to make the text inside a link. Links are the only element hover works on in IE and it is still pretty flaky in NS/Mozilla on other elements. If you want to know how to do it with hover, let me know and I'll post an example.

Here's one way to do it with onmouseover:
Code:
<html>
<head>
<script language=&quot;javascript&quot; type=&quot;text/javascript&quot;>
var hovercolor = &quot;blue&quot;
var origcolor  = &quot;white&quot;
</script>
</head>
<body>
<table>
<tr>
	<td onmouseover=&quot;this.style.backgroundColor = hovercolor&quot; onmouseout=&quot;this.style.backgroundColor = origcolor&quot;>Text</td>
</tr>
</table>
</body>
</html>
 
ahh, thanx thats exactly what i was looking for. for some reason my mind was takinga vacation. For God so loved the world that he gave his one and only son, that whoever believes in him won't die but have everlasting life - Jesus - John 3:16 -
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top