jquery 首行为蓝色 之后的每个第三行设置成红色

使用jQuery实现一个的table效果,首行背景颜色为蓝色(Blue),之后的每三行,设置一行背景颜色为红色:
图片说明

图片说明能成这样的?

$("thead").css("background","#00F");
$("#tb tbody tr:nth-child(3n)").css("background","red");
jQuery中执行这两行代码即可,其中thead包含标题头内容,tb为table的id

获取table中列的集合,遍历集合,设置第一个为行

 for(var i=0;i<s.length;i++){
 if(i==0){
 //设置为蓝
 }
 if(i%3=1){
 //设置为红,
 }
 //不设置。。
 }

$(function(){
// console.table($('#one tr'))
for(var i=0;i<$('#one tr').length;i++){
if(i==0){
$('#one tr')[i].style.backgroundColor="blue"
}
if(i%3==0&&i!=0){
$('#one tr')[i].style.backgroundColor="red"
//设置为红,
}
//不设置。。
}
})

$(function(){
// console.table($('#one tr'))
for(var i=0;i<$('#one tr').length;i++){
if(i==0){
$('#one tr')[i].style.backgroundColor="blue"
}
if(i%3==0&&i!=0){
$('#one tr')[i].style.backgroundColor="red"
//设置为红,
}
//不设置。。
}
})