当先锋百科网

首页 1 2 3 4 5 6 7
隔行变色、隔列变色

$(function () {

$("table:eq(0) tr").each(function () {

$(this).find("td").each(function (i) {

if (i%2 != 0) {

$(this).css("background-color","#CCCCFF");

} else {

$(this).css("background-color","white");

}

});

});

$("table:eq(1) tr").each(function (i) {

if (i%2 != 0) {

$(this).css("background-color","white");

} else {

$(this).css("background-color","#CCCCFF");

}

});

$("table:eq(2)").find("tr:even").css("background-color","white").end().find("tr:odd").css("background-color","#CCCCFF");

$("table:eq(3) tr").find("td:even").css("background-color","white").end().find("td:odd").css("background-color","#CCCCFF");

});

123
123
123
123
123

123
123
123
123
123

123
123
123
123
123

123
123
123
123
123