查找DataGrid中控件方法

一,直接循环:
function CheckDate()

    var grid = document.getElementById("DataGrid1"); 
    for (var i = 2;i < grid.rows.length +2; i++) {
     if (document.getElementById('DataGrid1__ctl'+i+'_CheckBox1').checked == true) { 
        alert("在输入附件或者备注情况下,必须填写生效日期。"); 
        return false; 
        } 
    }
}
二,排除其他:
function SetCheckState(){
   var elem = document.Form1.elements;
   if (document.Form1.all.DataGrid1__ctl2_CheckBox1.checked == true){
    for (var i = 0; i < elem.length; i++){
     if (elem[i].type == "checkbox" && elem[i].id != "DataGrid1__ctl2_CheckBox1"){
      elem[i].checked = true;
     }
    }
   }
  }
posted @ 2008-01-22 12:58  Shapley  阅读(271)  评论(0编辑  收藏  举报