<tr>
<logic:iterate id="list" name="Info13Form" property="systemList"   type="jp.co.daiei.karte.initial.fv2master.model.MeasureInfo"><td><html:multibox property="systemCheckValues" name="Info13Form" value="${list.measureCode}"/>
</td><td><bean:write name="list" property="measureName"/>
</td></logic:iterate><td><input type="button" class="pageButtonHrClass" value="全選択" onClick="allSelected()"></td>
</tr>在form里已定义了:
    /**
     * checkBox的list
     */
    private ArrayList systemList = new ArrayList();
    
    /**
     * checked选项
     */
    private String[] systemCheckValues = null;在 jp.co.daiei.karte.initial.fv2master.model.MeasureInfo已定义了:
   /**
     * 代码
     */
    private String measureCode = "";
    /**
     * 名字
     */
    private String measureName = "";求allSelected()方法来实现checkBox的全选。

解决方案 »

  1.   

    给你个参照:<html>
    <head>
    <script language=javascript>
    function allSelected(){
    var i=0;
    for(i=1;i<10;i++){
    var obj = document.getElementById("chk" + i);
    alert(obj);
    if(obj !=undefined){
    obj.checked=true;
    }
    }
    }
    </script>
    </head>
    <body>
    <input type=checkbox name=chk1  value="1"/>
    <input type=checkbox name=chk2  value="2"/>
    <input type=checkbox name=chk3  value="3"/>
    <input type=checkbox name=chk4  value="4"/>
    <input type=button value="Select" onclick="allSelected();"/>


    </body>
    </html>
      

  2.   

    根据生成页面的source来拼写对象的名字,循环出来的对象都是有规律的.
      

  3.   

    <tr>
    <td align="right">下发地区:</td>
    <td ><input type="checkbox" name="all" onclick="return doCheckAll(this);"/>全部</td>
    </tr>
    <tr>
    <td colspan="7">
    <logic:iterate id="localList" name="localList">
    <html:multibox property="chck">
    <bean:write name="localList" property="localId"/>
    </html:multibox>
    <bean:write name="localList" property="localName"/>
    </logic:iterate>
    </td>
    </tr>
    js:
    function doCheckAll(all){

    var ChkEls=document.getElementsByName("chck");

      for(var i=0;i<ChkEls.length;i++){
      if(ChkEls[i].type != "checkbox"){
      continue;
      }else{
      if(all.checked){
      ChkEls[i].checked= true;
      }else{
      ChkEls[i].checked= false;
      }
      }
      }
     
    }
      

  4.   

    function checkAll(){
        var checklist = document.getElementsByName("checkList");
        if (form_list.check_all.checked==true){
            for(var i=0;i<tablelist.rows.length-1;i++){
               if(checklist[i].disabled==false){
                checklist[i].checked=true;}
            }
        }
        else{
            for(var i=0;i<tablelist.rows.length-1;i++){
                checklist[i].checked=false;
            }
        }
    }