dataset隔行换色以及jquery高亮

<asp:DataList ID="DataList1" Width="100%" runat="server">
<ItemTemplate>
<table style="width:100%; background-color:#ffffff; border-bottom: #ffcc66 2px solid;" cellspacing="0">
<tr>
<td colspan="2">

</td>
</tr>
</table>
</ItemTemplate>
<AlternatingItemTemplate>
<table style="width:100%; background-color:#000000; border-bottom: #ffcc66 2px solid;" cellspacing="0">
<tr>
<td colspan="2">

</td>
</tr>
</table>
</AlternatingItemTemplate>
</asp:DataList>
这样是隔行显示黑白色,其中
<AlternatingItemTemplate>
就是设置隔行显示的模式
dlHTList是dataset的id
$("#dlHTList").live("mouseover",function(e){
         $(e.target).parent().addClass("activeRow");
return false;
}).live("mouseout", function(e) {
$(e.target).parent().removeClass("activeRow");
return false;
});


css伪类简单高亮  等同上边的代码

/*高亮*/
#dlHTList tr:hover /*dlHTList-->dataset的id*/
{
background-color:RGB(184,204,228);
}

dataset 相当于 <table>

ItemTemplate 相当于<tr>

posted @ 2011-09-23 15:50  一个土豆一棵青菜  阅读(276)  评论(0)    收藏  举报