日期:2014-05-16  浏览次数:20379 次

关于字体颜色切换的问题?
<table   width= "150 "   border= "0 "   align= "center "   cellpadding= "0 "   cellspacing= "0 ">
  <tr>
    <td   width= "50 "> AAA </td>
    <td   width= "50 "> BBB </td>
    <td   width= "50 "> CCC </td>
  </tr>
</table>
这个表里有三个td,当光标移到 "AAA "时,字体颜色变为红色,光标移走时颜色不变.当光标移到 "BBB "时, "BBB "字体颜色显示为红色,同时 "AAA "恢复为原来的颜色. "CCC "也同样的道理.代码怎么写?

------解决方案--------------------
<table width= "150 " border= "0 " align= "center " cellpadding= "0 " cellspacing= "0 ">
<tr>
<td width= "50 " onmouseover= "this.style.color= 'red ' " onmouseout= "this.style.color= 'black ' "> AAA </td>
<td width= "50 " onmouseover= "this.style.color= 'red ' " onmouseout= "this.style.color= 'black ' "> BBB </td>
<td width= "50 " onmouseover= "this.style.color= 'red ' " onmouseout= "this.style.color= 'black ' "> CCC </td>
</tr>
</table>

------解决方案--------------------
<table width= "150 " border= "0 " align= "center " cellpadding= "0 " cellspacing= "0 ">
<tr>
<td width= "50 " onmouseover= "chg(this) "> AAA </td>
<td width= "50 " onmouseover= "chg(this) "> BBB </td>
<td width= "50 " onmouseover= "chg(this) "> CCC </td>
</tr>
</table>
<script>
function chg(o)
{
t = document.getElementsByTagName( "td ");
for(c=0;c <t.length;c++) t[c].style.color= " ";
o.style.color = "red ";
}
</script>
------解决方案--------------------

<tr> 中这么写

<tr bgcolor= "#ffffff " align= "center " onMouseOver= "this.bgColor= '#C4DAF0 '; " onmouseout= "this.bgColor= '#ffffff '; " >

------解决方案--------------------
http://topic.csdn.net/t/20051027/21/4355310.html