var num=0 
for (var i=0;i<document.form1 .elements .length;i++)
    {
       if ((document.form1 .elements [i].type=="checkbox") &&      
                (document.form1.elements [i].checked))
         {
            num++   (被选中的数量) 
         }
    }

解决方案 »

  1.   

    用遍歷不就行了嗎function aaa()
    {
    var i=0;
    for(j=0;j<document.modForm.chkMod.length;j++)
    {
    if(document.modForm.chkMod.checked)
    {i++;
    }
    }
    return i;
    }
      

  2.   

    把form1改成你的表名:modForm 在num++前面加一句alert(document.modForm.elements[i].value) 看一下你就明白了.
      

  3.   

    if(document.modForm.chkMod.checked)
    改成
    if(document.modForm.chkMod[j].checked)
      

  4.   

    以上方法基本上都可行,
    提交后可以这样得到 String picked[]=request.getParameterValues("chkMod ");
      if(picked!=null&&picked.length!=0)
      {
       for(int i=0;i<picked.length;i++)
          {........
    ....