求:使用JS判断struts2标签的CheckBoxList是否未选中的代码,感谢
我的jsp其中一组checkboxList如下:<tdclass="info_td"><spanclass="info_td2">事件级别:</span></td><td...
我的jsp其中一组checkboxList如下:
<td class="info_td"> <span class="info_td2">事件级别: </span> </td>
<td class="info_td2" nowrap>
<yn:queryForList sql="from DtCodeMaster where codeKey='ALARTMEVENTLEVEL' order by codeId" id="eventLevelList" managerBean="managerDTM"/>
<s:checkboxlist name="q_eventLevel" value="%{#attr.conditionMap.q_eventLevel}" list="#attr.eventLevelList" listKey="codeId" listValue="codeName" >
</s:checkboxlist>
</td>
提问:我该如何用JAVASCRIPT来判断这组复选框是否被选中?若未被选中,alert("XXXX"),急求代码,网上查了很多资料,也有大大们放代码上去,但是好像针对我这个s:checkboxlist 标签实现不了,有谁知道嘛~ 展开
<td class="info_td"> <span class="info_td2">事件级别: </span> </td>
<td class="info_td2" nowrap>
<yn:queryForList sql="from DtCodeMaster where codeKey='ALARTMEVENTLEVEL' order by codeId" id="eventLevelList" managerBean="managerDTM"/>
<s:checkboxlist name="q_eventLevel" value="%{#attr.conditionMap.q_eventLevel}" list="#attr.eventLevelList" listKey="codeId" listValue="codeName" >
</s:checkboxlist>
</td>
提问:我该如何用JAVASCRIPT来判断这组复选框是否被选中?若未被选中,alert("XXXX"),急求代码,网上查了很多资料,也有大大们放代码上去,但是好像针对我这个s:checkboxlist 标签实现不了,有谁知道嘛~ 展开
展开全部
<head>
<script type="text/javascript">
function t(){
var allTest = document.all.test;
if(allTest.length==null){
if(!allTest.checked){
alert(allTest.value+"--未选中");
}
}else{
for(var i=0;i<allTest.length;i++){
if(!allTest[i].checked){
alert(allTest[i].value+"--未选中");
}
}
}
}
</script>
</head>
<body>
<s:form onsubmit="t();">
<s:checkboxlist list="{'a','b','c'}" name="test" label="请选择"></s:checkboxlist>
<s:submit></s:submit>
</s:form>
</body>
<script type="text/javascript">
function t(){
var allTest = document.all.test;
if(allTest.length==null){
if(!allTest.checked){
alert(allTest.value+"--未选中");
}
}else{
for(var i=0;i<allTest.length;i++){
if(!allTest[i].checked){
alert(allTest[i].value+"--未选中");
}
}
}
}
</script>
</head>
<body>
<s:form onsubmit="t();">
<s:checkboxlist list="{'a','b','c'}" name="test" label="请选择"></s:checkboxlist>
<s:submit></s:submit>
</s:form>
</body>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询