//设置table中偶数行的背景色
$("#tableID tr:nth-child(even)").css({"background-color":"#E4F5FF"});
//绑定事件当鼠标放到元素上背景颜色,
以及鼠标移开时背景颜色(会根据奇偶行判断设置不同的背景色)
$("#tableID tr").mouseover(function(){
$(this).css({"background-color":"#87CEEB"});
}).mouseout(function(event){
var $index=$(this).index();
if($index%2==0){
$(this).css({"background-color":"#fff"});
}else{
$(this).css({"background-color":"#E4F5FF"});
}
});