方式一:
.select{
background: #0066FF;
}
$("tbody>tr").mouseover(function(){
$(this).addClass("select");
})
$("tbody>tr").mouseout(function(){
$(this).removeClass("select");
});
方式二:
在需要变颜色的地方加入这样一段代码:
<tr οnmοuseοut="this.style.backgroundColor=''" οnmοuseοver="this.style.backgroundColor='#FFcccc'">
也就是将<tr>标签里面加入οnmοuseοut="this.style.backgroundColor=''" οnmοuseοver="this.style.backgroundColor='#FFcccc'"
如果改变单元格的颜色就加在<td>标签里面:
<td οnmοuseοut="this.style.backgroundColor=''" οnmοuseοver="this.style.backgroundColor='#FFcccc'">