让选中的列变色 我用代码选中一个数据源控件中的一个CheckBox,如何用jquery让这行灰掉?选中一行灰一行,我需要在系统里实时判断。求解 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://www.51obj.cn/demo/jquery/jquery_table.html $(":checkbox").chick(function() { if($(this).attr("checked")) { $(this).parents("tr").eq(0).css("background-color","blue"); } else { }}); $(":checkbox").each(function() { if($(this).attr("checked")) { $(this).parents("tr").eq(0).css("background-color","gray"); }}); 这个选择器你需要修改的,毕竟我不知道你的HTML。不过意思就是 这个 邓肯兄,你好。我是在Button2_Click事件中判断的,通过代码改变数据库中的bool字段为"true",然后在页面判断这行中的CheckBox选中。 this.lstOrders.DataBind(); for (int i = 0; i < lstOrders.Items.Count; i++) { if (reader.Read()) { if (reader["bool"].ToString() == "true") { ((CheckBox)lstOrders.Items[i].FindControl("cb")).Checked = true; } } }<td style="height: 20px; background-color: #FFFFFF"> <div style="text-align: center"> <span> <asp:CheckBox ID="cb" runat="server" Enabled="false"/></span> </div> </td> 如何在后台加?我这里不能用listview自带的事件呢·· http://blog.csdn.net/21aspnet/archive/2007/03/25/1540301.aspx <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>测试</title><style>.high{ background:#999;}</style><script src="jquery-1.3.2.js"></script><script>$(function(){ $("input[type=checkbox]").change(function(){ if($(this).is(":checked")){ $(this).parent().css("readonly",true); $(this).parent().addClass("high").siblings().removeClass("high"); }else{ $(this).removeClass("high"); } });});</script></head><body><div class="test"><input type="checkbox" />11111</div><div class="test"><input type="checkbox" />22222</div><div class="test"><input type="checkbox" />33333</div><div class="test"><input type="checkbox" />44444</div></body></html>是这样吗 GridView1.Rows[i].Cells[4].BackColor = System.Drawing.Color.Red;GridView里面能这么写。ListView只能点到lstOrders.Items[i]后面就没控件的样式了。郁闷 回lieri111兄。页面打开没效果,ChcekBox被程序判断选中也没效果 $("input[type=checkbox]").change(function()能否改成,页面一加载就判断checkbox是否被选中了,现在checkbox被选中不是手动点击,是程序判断,然后给自动勾选中的 jquery幻灯片在chrome下的问题!! 求个最大化、还原、最小化、导入和导出的图标(解决立即给分) js问题焦点切换问题 请教一个JS相册特效问题 javascript 中怎么弹出文件保存对话框? javascript页面的编码问题 javascript中定义字符串,怎样才能够含有&符号? 请教大家 缺少对象,为什么? 急!一个有关表单提交的问题,恳请帮助,高分相赠! 如何在确定后才转跳到别的页面??? 请问这种JS写法是什么?数组?类?
if($(this).attr("checked")) {
$(this).parents("tr").eq(0).css("background-color","blue");
} else {
}
});
if($(this).attr("checked")) {
$(this).parents("tr").eq(0).css("background-color","gray");
}
});
for (int i = 0; i < lstOrders.Items.Count; i++)
{
if (reader.Read())
{
if (reader["bool"].ToString() == "true")
{
((CheckBox)lstOrders.Items[i].FindControl("cb")).Checked = true;
}
} }<td style="height: 20px; background-color: #FFFFFF">
<div style="text-align: center">
<span>
<asp:CheckBox ID="cb" runat="server" Enabled="false"/></span>
</div>
</td>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>测试</title>
<style>
.high{
background:#999;
}
</style>
<script src="jquery-1.3.2.js"></script>
<script>
$(function(){
$("input[type=checkbox]").change(function(){
if($(this).is(":checked")){
$(this).parent().css("readonly",true);
$(this).parent().addClass("high").siblings().removeClass("high");
}else{
$(this).removeClass("high");
}
});
});
</script>
</head><body>
<div class="test"><input type="checkbox" />11111</div>
<div class="test"><input type="checkbox" />22222</div>
<div class="test"><input type="checkbox" />33333</div>
<div class="test"><input type="checkbox" />44444</div>
</body>
</html>
是这样吗
GridView1.Rows[i].Cells[4].BackColor = System.Drawing.Color.Red;GridView里面能这么写。ListView只能点到lstOrders.Items[i]后面就没控件的样式了。郁闷
页面打开没效果,ChcekBox被程序判断选中也没效果
$("input[type=checkbox]").change(function()能否改成,页面一加载就判断checkbox是否被选中了,现在checkbox被选中不是手动点击,是程序判断,然后给自动勾选中的