请问怎么样获得WEBFORM中有哪些checkBox被选定。THANK

解决方案 »

  1.   

    foreach (Control c in this.Controls[1].Controls)
    {
        if (c is ChecBox)
        {
            checkBox myCheck = (CheckBox)c;
            if(myCheck.Checked)
                 {
                  ................
                   }
        }
    }
      

  2.   

    var inputs = document.all.tags("INPUT");
     for (var i=0; i < inputs.length; i++)
     {
        if (inputs[i].type == "checkbox")
            .......}
      

  3.   

    循环判断页面中的checkbox的Checked属性,
      

  4.   

    前 document.all.CheckBoxID.checked
    后 CheckBoxID.Checked
      

  5.   

    foreach (Control c in this.Controls[1].Controls)
    {
        if (c is ChecBox)
        {
            checkBox cb = (CheckBox)c;
            if(cb.Checked)
                 {
                  ................
                   }
        }
    }
      

  6.   

    用script了
    var arychk = document.getElementsByTagName('input');
    var rs = '';
    for (var i=0; i<arychk.length; i++)
    {
    if (arychk[i].type == "checkbox")
    {
    if (arychk[i].checked)
    {
    rs += ',' + arychk[i].value;
    arychk[i].disabled = true;
    }
    }
    }
    稍微改一下用