如何样式里加onmouseover?

来源:百度知道 编辑:UC知道 时间:2024/06/05 08:34:41
我想在css里加上个 鼠标滑入变化td的背景颜色
请问高手 样式该咋写?多谢!
.banner{
onmouseover:background-Color: #E8E8E8;
onmouseout:background-Color: #ffffff;
}
就是这种样子的 但是我这写的有问题

'这个事件不应写在CSS里.按下面写,这样写你还可以将TD中的其它元素属性变更下,例如字体,大小...
.banner{background-Color: #ffffff;}
.banner1{background-Color: #E8E8E8;}

'在对象里这样写
<td class="banner" onmouseover="this.className='banner1'" onmouseout="this.className='banner'">....</td>

<table>
<tr>
<td onmouseover=this.style.backgroundColor='#FFFFCC' onmouseout=this.style.backgroundColor='#DDDDDD'><a href="#">TDTDTD</A></td>
<td onmouseover=this.style.backgroundColor='#CCCCCC' onmouseout=this.style.backgroundColor='#EEEEEE'><a href="#">tdtdtd</A></td>
</tr>
</table>

<style type="text/css">
table{cursor:hand;}
td{
onmouseover: expression(onmouseover=function (){this.style.backgroundCo