`
zhaoliaoyuan
  • 浏览: 21519 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
文章分类
社区版块
存档分类

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}"
                        onclick="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
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics