Home >Web Front-end >JS Tutorial >JS JSP checkBox select all specific implementation_javascript skills

JS JSP checkBox select all specific implementation_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:05:34914browse
复制代码 代码如下:

<script> <br>function func(){ <br>var options=document.getElementsByName("chkBox"); <br>for (var i=0;i<options.length;i ){ <BR>if(!options[i].disabled){ <BR>options[i].checked=true; <BR>} <BR>} <BR>} <BR></script>






用javascript吧。
复制代码 代码如下:



<script> <br>function kk(){ <br>var handleEl = document.getElementById("kkHandler"); <br>var els = document.getElementsByName("kk"); <br>for(i=0;i<els.length;i ){ <BR>els[i].checked = handleEl.checked; <BR>} <br><br>} <BR></script>
全选






2:
复制代码 代码如下:


1
2
allselect

<script> <br>function selectAll() <br>{ <br>if(!document.form.id.length){ <br>if(document.form.chose.checked){ <br>document.form.id.checked=true; <br>} <br>else{ <br>document.form.id.checked=false; <br>} <br>} <br>else{ <br>for(var i=0;i<document.form.id.length;i ){ <BR>if(document.form.chose.checked){ <BR>document.form.id[i].checked=true; <BR>} <BR>else{ <BR>document.form.id[i].checked=false; <BR>} <BR>} <BR>} <BR>} <BR></script>

3:
复制代码 代码如下:








<script> <br>function check_all(){ <br>arr = document.getElementsByName('info'); <br>for(i=0;i<arr.length;i ){ <BR>arr[i].checked = true; <BR>} <BR>} <BR></script>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn