CSS实现表格隔行颜色不一样并感应鼠标
相比于JS或者JQuery来说,我更喜欢这个,留个脚印
tr {background-color:expression((this.sectionRowIndex%2==0)?"#E1F1F1":"#F0F0F0");
onmouseover: expression(onmouseover=function (){this.style.borderColor ='blue';this.style.color='red';this.style.backgroundColor ='#e1e1e1'});
onmouseout: expression(onmouseout=function (){this.style.borderColor='';this.style.color='';this.style.backgroundColor =''});
}
测试发现,IE6不兼容,造成页面假死,慎用
改进一下兼容滴代码
tr {background-color:expression((this.sectionRowIndex%2==0)?"#E1F1F1":"#F0F0F0");
}
tr:hover{background-color:#E1E1E1}
td{height:28px;padding:5px;line-height:22px}