亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

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

original 2016-11-08 11:14:38 346
abstrait:一、隔行換色$("tr:odd").css("background-color","#eeeeee");  $("tr:even").css("background-color","#ffffff");或者一行搞定:$("table tr:nth-c

一、隔行換色

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

或者一行搞定:

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

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

二、鼠標(biāo)經(jīng)過變色 

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

或者  

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

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


Notes de version

Entrées populaires