亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

jQuery實現(xiàn)table隔行換色和鼠標(biāo)經(jīng)過變色的兩種方法

 更新時間:2014年06月15日 10:03:22   投稿:whsnow  
這篇文章主要介紹jQuery實現(xiàn)table隔行換色和鼠標(biāo)經(jīng)過變色的兩種方法,需要的朋友可以參考下
一、隔行換色
復(fù)制代碼 代碼如下:

$("tr:odd").css("background-color","#eeeeee");
$("tr:even").css("background-color","#ffffff");

或者一行搞定:
復(fù)制代碼 代碼如下:

$("table tr:nth-child(odd)").css("background-color","#eeeeee");

:nth-child 匹配其父元素下的第N個子或奇偶元素

二、鼠標(biāo)經(jīng)過變色
復(fù)制代碼 代碼如下:

$("tr").live({
mouseover:function(){
$(this).css("background-color","#eeeeee");
},
mouseout:function(){
$(this).css("background-color","#ffffff");
}
})

或者
復(fù)制代碼 代碼如下:

$("tr").bind("mouseover",function(){
$(this).css("background-color","#eeeeee");
})
$("tr").bind("mouseout",function(){
$(this).css("background-color","#ffffff");
})

當(dāng)然live()和bind()都可以同時綁定多個事件或分開。

相關(guān)文章

最新評論