<asp:CheckBox ... onclick="CheckOnChange(this)" ></asp:CheckBox>
function CheckOnChange(ctrl)
{
var trRow = ctrl.parentElement.parentElement;
if(trRow != null)
{
if(ctrl.checked)
trRow.setAttribute("bgcolor", "AliceBlue", 0);
else
trRow.setAttribute("bgcolor", "#ffffff", 0);
}
}
是不是 AliceBlue 颜色太淡了,看不清呀?呵呵,换成Blue好了。
还有setAttribute只对IE有效。
本文介绍了一种在ASP.NET中使用CheckBox控件时,通过JavaScript实现背景颜色改变的方法,并讨论了颜色选择及setAttribute方法的浏览器兼容性问题。
5203

被折叠的 条评论
为什么被折叠?



