js分组进行全选和全不选

<script type="text/javascript">
function funCheckAll(obj) {
  var code_Values = document.getElementsByName(obj);
   for(i = 0;i < code_Values.length;i++){
      if(code_Values[i].type == "checkbox") {
        code_Values[i].checked = true;
       }
   }
}
 
 function uncheckAll(obj) {
   var code_Values = document.getElementsByName(obj);
   for(i = 0;i < code_Values.length;i++){
    if(code_Values[i].type == "checkbox") {
        code_Values[i].checked = false;
        flag=true;
       }
    }
}

</script>

 

 

 

jsp页面中的格式:

 

 

 

<logic:iterate id="declass" name="lstIndexClass">
            <tr>
                <td>
                    <input type="checkbox" id="chkbx"
                        name="cbSelect${declass.indexClassId}"
                        οnclick="javascript: if(this.checked==true){funCheckAll('chkSel${declass.indexClassId}');}else{uncheckAll('chkSel${declass.indexClassId}');}" />

                </td>
                <td colspan="4">
                    <strong><c:out value="${declass.typeName}"></c:out> </strong>
                    <input name="indClsId" type="hidden"
                        value="${declass.indexClassId}">
                </td>
            </tr>
            <logic:iterate id="item" name="lstindex">
                <logic:match name="item" property="typeName"
                    value="${declass.typeName}">
                    <tr>
                        <td>
                        <logic:empty name="lstCorpIndex">    <input type="checkbox" id="chk"
                                name="chkSel${declass.indexClassId}" value="${item.indexInfoId}" /></logic:empty>
                        <logic:notEmpty name="lstCorpIndex">
                        <logic:iterate id="cpind" name="lstCorpIndex">
                         <logic:match name="cpind" property="index_info_id" value="${item.indexInfoId}">
                            <input type="checkbox" id="chk"
                                name="chkSel${declass.indexClassId}" value="${item.indexInfoId}" checked="checked" />
                                </logic:match>
                                 <logic:notMatch name="cpind" property="index_info_id" value="${item.indexInfoId}">
                           
                                </logic:notMatch>
                                </logic:iterate>
                        </logic:notEmpty>
                        </td>
                        <td>
                            <c:out value="${item.indexName}"></c:out>
                            <input name="indInfoId${declass.indexClassId}" type="hidden" value="${item.indexInfoId}" />
                        </td>
                        <td>
                            <c:if test="${item.indexType==1}">系统指标</c:if>
                            <c:if test="${item.indexType==0}">自定义指标</c:if>
                        </td>
                        <td>
                            <c:out value="${item.computeExpression}"></c:out>
                        </td>
                        <td>
                            <c:out value="${item.rmk }"></c:out>
                        </td>
                    </tr>
                </logic:match>
            </logic:iterate>
        </logic:iterate>


 

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值