showlike 发表于 2013-2-3 14:38:42

table 奇偶行背景色 鼠标移动行颜色变化

//设置table中偶数行的背景色$("#tableIDtr: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"});   }   });
页: [1]
查看完整版本: table 奇偶行背景色 鼠标移动行颜色变化