天天看点

DataGrid中有一列是CheckBox,要求点一个CheckBox,对应的这一行变色,

<asp:CheckBox ... οnclick="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有效。

继续阅读