asp.net中 gridview的生成table,标题行是<tr><th>title</th></tr>的格式。
现在想要在除标题行以外鼠标move过有变色效果。
这样是可以实现的。 $(document).ready(function()
{
var bgcolor;
$('#GridView1 td').hover(function()
{
bgcolor=$(this).css('background-color');
$(this).parent().css('background-color','#faa');
},
function()
{
$(this).parent().css('background-color',bgcolor);
}
);
}
);
但是$('#GridView1 tr').notcontains[th].hover(function()
为什么不行。
在jquery中如何排除tr以下的某个子元素啊??
应该怎么写?40分的传送门:http://topic.csdn.net/u/20100322/16/ecc3fca2-c3b3-4317-b866-0f84b9fe28c9.htmljs区人气太低了
现在想要在除标题行以外鼠标move过有变色效果。
这样是可以实现的。 $(document).ready(function()
{
var bgcolor;
$('#GridView1 td').hover(function()
{
bgcolor=$(this).css('background-color');
$(this).parent().css('background-color','#faa');
},
function()
{
$(this).parent().css('background-color',bgcolor);
}
);
}
);
但是$('#GridView1 tr').notcontains[th].hover(function()
为什么不行。
在jquery中如何排除tr以下的某个子元素啊??
应该怎么写?40分的传送门:http://topic.csdn.net/u/20100322/16/ecc3fca2-c3b3-4317-b866-0f84b9fe28c9.htmljs区人气太低了
解决方案 »
- 关于Win 2003 + IIS6.0 + .net1.1 Forms验证
- 请教atlse高手:registerAbstractClass不能用了吗?
- dropdownlist回发后页面刷新找不到选择结果
- 我要写个分类管理~想把二级分类读到一级分类下面~应该怎么做?
- 哪个神仙哥哥,能帮小弟解决幼稚的问题!!!!
- DataGrid问题,EditItemTemplate项处于编辑状态时,怎么控制编辑框的大小?
- 关于PowerDesigner 关联的名称修改 简单
- 请问这个配置错误如何改?
- 在TreeView中怎样获得一个节点(或子节点)的句柄???具体请看里面!
- 将项目发布打IIS上面,PPT转化图片异常提示 PowerPoint could not open the file
- Group by 的问题
- 请教高手鼠标事件?
{
var bgcolor;
$('#GridView1 tr').hover(function()
{
bgcolor=$(this).css('background-color');
$(this).parent().css('background-color','#faa');
},
function()
{
$(this).parent().css('background-color',bgcolor);
}
);
}
);
if (Grid.Rows.Count > 0)
{
//This replaces <td> with <th> and adds the scope attribute
.UseAccessibleHeader = true; //This will add the <thead> and <tbody> elements
Grid.HeaderRow.TableSection = TableRowSection.TableHeader; //This adds the <tfoot> element.
//Remove if you don't have a footer row
Grid.FooterRow.TableSection = TableRowSection.TableFooter;
}这样渲染出来的html代码包含<tbody>代码,jquery代码改成$('#GridView1 tbody td').hover(function()
{
//This replaces <td> with <th> and adds the scope attribute
Grid.UseAccessibleHeader = true;//This will add the <thead> and <tbody> elements
Grid.HeaderRow.TableSection = TableRowSection.TableHeader;//This adds the <tfoot> element.
//Remove if you don't have a footer row
Grid.FooterRow.TableSection = TableRowSection.TableFooter;
}
$('#<%= GridView1.ClientID%> tr:not(:has("th"))')
果然可以了。
哈哈。
那么多花真让人眼红啊。。
2楼的:我的意思是th不让它变色。
4楼的:后台代码我知道,但会增加服务器负担。
js同样也可以。但现在在看jquer么,当然用jquer了。