<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的全选。
<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的全选。
解决方案 »
- java类型错误java.lang.Integer cannot be cast to java.lang.String
- Session 过期问题 ,急!
- session 里面有多个值 怎么样和 js里单个值做比较?
- Myeclipse运行项目是出错
- 问一个struts得问题,很不明白
- 请教各位一个beanUtil中的copyProperties()的问题
- 关于使用struts标签的问题
- 有关javabean的问题,大家帮我看看
- 连接池一段时间后出现错误,重启机子后又正常,什么原因啊???
- java的Bug
- 判断用户名是否可用,帮帮忙,谢谢了!
- 用了struts,<body background="img/right.jpg"> 没有效果了?
<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>
<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;
}
}
}
}
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;
}
}
}