jquery隔行变色代码

 方法1:

$("tr").each(function(i){this.style.backgroundColor=['#ccc','#fff'][i%2]}) //实现表格的隔行换色效果

 

方法2:

 $("tr:even").addClass("alt");    //给表格的偶数行添加class值为alt   

 

posted @ 2011-10-18 15:19  风一样的大叔  阅读(213)  评论(0编辑  收藏  举报