Entry
Is it possible to change the color of the text inside the <td> when mouse over the cell?
Dec 5th, 2002 15:04
Jason Ross, Ruel Dizon,
yes. the easiest way is to use css. sample code follows:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
// This sets the font color during the mouseover
.on {
color: #CC0000;
}
// This returns the font back to the normal color on mouseout
.off {
color: #000000;
}
-->
</style>
</head>
<body text="#000000" bgcolor="#FFFFFF">
<table width="90%" border="1" cellspacing="1" cellpadding="1">
<tr>
<td onMouseOver="this.className='on'"
onMouseOut="this.className='off'">This is some text</td>
</tr>
<tr>
<td onMouseOver="this.className='on'"
onMouseOut="this.className='off'">This is some other text</td>
</tr>
</table>
</body>
</html>