$("#table tr:nth-child(odd)").css("background-color","#E6E6FA"); //设置奇数行的背景色
$("#table tr:nth-child(even)").css("background-color","#FFF"); //设置偶数行的背景色
jQuery中设置html的外部样式表的奇偶行交替色类似
最新推荐文章于 2022-06-22 10:14:36 发布

$("#table tr:nth-child(odd)").css("background-color","#E6E6FA"); //设置奇数行的背景色
$("#table tr:nth-child(even)").css("background-color","#FFF"); //设置偶数行的背景色