$(function(){
$('tr').each(function(i){
this.style.backgroundColor=["#eee","#ccc"][i%2];//实现表格隔行换色、因为索引只能差生基数和偶数、故数组中的元素只有两种
})
})
$(function(){
$('p').each(function(i){
this.style.backgroundColor=["#eee","#ccc",'red',"#EEE"][i];//给索引为0、1、2、3的段落都变色
})
})
$('tr').each(function(i){
this.style.backgroundColor=["#eee","#ccc"][i%2];//实现表格隔行换色、因为索引只能差生基数和偶数、故数组中的元素只有两种
})
})
$(function(){
$('p').each(function(i){
this.style.backgroundColor=["#eee","#ccc",'red',"#EEE"][i];//给索引为0、1、2、3的段落都变色
})
})