我使用下面的jquery脚本突出显示asp.net网格视图中的每一行,并且运行良好。但是网格的页眉和页脚也会改变鼠标上方的颜色,这显然是我不希望发生的。
有什么想法吗?我还需要在脚本上插入什么来阻止网格页眉/页脚改变颜色?
谢谢
$("table.STD_GridView tr").mouseover(function (event) {
var color = $(this).css("background-color");
$(this).css("background", "#f6f6f6");
$(this).bind("mouseout", function () {
$(this).css("background", color);
})
}修正:
下面是创建的一些代码(与头有关):
<th align="left" scope="col"><a href="javascript:__doPostBack('GridView1','Sort$VF')" style="color:White;">Validity</a></th>发布于 2015-03-03 17:57:29
Gridviews允许您将页眉和页脚的样式与数据行分开,而数据行本身也可以被样式化。我的意思是屁股是一个阶级的名字。例如:
<tbody>
<tr class="gvHeaderStyle" ></tr>
<tr class="gvRowStyle" ></tr>
<tr class="gvAlternatingRowStyle"></tr>
<tr class="gvFooterStyle"></tr>
</tbody>做这样的事情应该很简单:
<tbody>
<tr class="gvHeaderStyle" ></tr>
<tr class="gvRowStyle HoverableRow" ></tr>
<tr class="gvAlternatingRowStyle HoverableRow"></tr>
<tr class="gvFooterStyle"></tr>
</tbody>然后只提供jquery:
$("table.STD_GridView tr.HoverableRow").mouseover( ...但此时您可以放弃jquery,只需执行css操作:
.HoverableRow {
background-color: <default>;
}
.HoverableRow:hover {
background-color: #F6F6F6
}https://stackoverflow.com/questions/28837499
复制相似问题