zoukankan      html  css  js  c++  java
  • Example015实现html中checkbox的全选和反选(2)

    <!DOCTYPE html>
    <html lang="en">
    <head>
    	<meta charset="UTF-8">
    	<title>实例015</title>
    </head>
    <body>
    	<form>
    		<label for="one"><input onclick="qx(this)" id="one" type="checkbox" >全选</label><br>
    
    		<input type="checkbox" name="username[]" value="handsomehan">handsomehan<br>
    		<input type="checkbox" name="username[]" value="handsomehan">handsomehan<br>
    		<input type="checkbox" name="username[]" value="handsomehan">handsomehan<br>
    		<input type="checkbox" name="username[]" value="handsomehan">handsomehan<br>
    		<input type="checkbox" name="username[]" value="handsomehan">handsomehan<br>
    		<input type="checkbox" name="username[]" value="handsomehan">handsomehan<br>
    		<input type="checkbox" name="username[]" value="handsomehan">handsomehan<br>
    		<input type="checkbox" name="username[]" value="handsomehan">handsomehan<br>
    		<input type="checkbox" name="username[]" value="handsomehan">handsomehan<br>
    		<input type="checkbox" name="username[]" value="handsomehan">handsomehan<br>
    		<input type="checkbox" name="username[]" value="handsomehan">handsomehan<br>
    		<input type="checkbox" name="username[]" value="handsomehan">handsomehan<br>
    		<input type="checkbox" name="username[]" value="handsomehan">handsomehan<br>
    		<input type="checkbox" name="username[]" value="handsomehan">handsomehan<br>
    		<input type="checkbox" name="username[]" value="handsomehan">handsomehan<br>
    		<input type="checkbox" name="username[]" value="handsomehan">handsomehan<br>
    	</form>
    	<script>
    		var obj = document.getElementsByName("username[]");
    
    		function qx(o) {
    			for(var i = 0; i < obj.length; i ++) {
    				obj[i].checked = o.checked;
    			}
    		}
    	</script>
    </body>
    </html>
    

      

  • 相关阅读:
    数据库表数据传输到Oracle方案
    Pdnovel 在线阅读体验
    Metaweblog博客分发体验
    Liveqrcode活码系统设计
    Java Language Changes for Java SE 9
    利用“计算器”和公式做房贷计算
    阿里云SLB快速切换至https
    Charles 协助解决 metaweblog 排序问题
    Go语言网络通信---连续通信的UDP编程
    Go语言网络通信---一个简单的UDP编程
  • 原文地址:https://www.cnblogs.com/handsomehan/p/5373128.html
Copyright © 2011-2022 走看看