Changing text color on table cell using onmouseover?

liunx

Guest
I'm a bit confused. The following code does everything you expect it too, except changing the color of the text in the cell, when the mouse is over it.<br />
<br />
<TABLE CLASS="kantlinje" CELLSPACING="2" CELLPADDING="2" ONMOUSEOVER="this.style.backgroundColor='#E0E0E0';" ONMOUSEOUT="this.style.backgroundColor='white'" WIDTH="150"><br />
<TR><TD BGCOLOR="Black"><SPAN CLASS="smallhead">Team members</SPAN></TD></TR><br />
<TR><TD ONMOUSEOVER="this.style.backgroundColor='gray'; this.style.fontWeight='bold'; this.style.color='#00FF00'" ONMOUSEOUT="this.style.backgroundColor='transparent'; this.style.fontWeight='normal'; this.style.color='aqua';" ONCLICK="document.location='members/info.txt'"><A HREF=http://www.htmlforums.com/archive/index.php/"members/anderselfgren.html">Anders Elfgren</A></TD><br />
</TR></TABLE><br />
<br />
These are the style sheets used above..<br />
.kantlinje {<br />
border: 5px gray;<br />
border-style: double;<br />
}<br />
.smallhead<br />
{<br />
fnt-variant : small-caps;<br />
text-align : center;<br />
color: white;<br />
font-weight: bolder;<br />
padding: 2<br />
}<!--content-->Hi there srekel,<br />
<br />
Here is your code with some alterations...<html><br />
<head><br />
<style type="text/css"><br />
<!--<br />
.kantlinje <br />
{<br />
border: 5px gray;<br />
border-style: double;<br />
}<br />
<br />
td.smallhead<br />
{<br />
fnt-variant : small-caps;<br />
text-align : center;<br />
color: white;<br />
font-weight: bolder;<br />
background-color:#000000;<br />
}<br />
<br />
td.one<br />
{<br />
text-align:center;<br />
}<br />
<br />
a<br />
{<br />
color:aqua;<br />
text-decoration:none;<br />
}<br />
//--><br />
</style><br />
</head><br />
<br />
<body><br />
<table class="kantlinje" cellspacing="2" cellpadding="2"width="150"><br />
<tr><br />
<td class="smallhead">Team members</td><br />
</tr><br />
<tr><br />
<td class="one"onmouseover="this.style.backgroundColor='gray';"onmouseout="this.style.backgroundColor='transparent';"><br />
<a href=http://www.htmlforums.com/archive/index.php/"members/anderselfgren.html"onmouseover=" this.style.fontWeight='bold';this.style.color='#00ff00'" <br />
onmouseout="this.style.fontWeight='normal'; this.style.color='aqua';">Anders Elfgren</a><br />
</td><br />
</tr><br />
</table><br />
</body><br />
</html><br />
<br />
Note that onclick="document.location='members/info.txt'" was in conflict with href=http://www.htmlforums.com/archive/index.php/"members/anderselfgren.html" so I have removed it :D <br />
I suggest that if you need to use it, then you put it in another td tag :cool: <br />
<br />
coothead<!--content-->
 
Back
Top