日期:2014-05-18  浏览次数:20733 次

求<html:multibox〉的全选的js该怎样写? 坐等!!!
<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的全选。



------解决方案--------------------
给你个参照:

<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>
------解决方案--------------------
<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>