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>
    

      

  • 相关阅读:
    asp.net 用户页面权限判断
    asp.net Forms表单验证授权
    asp.net 数据绑定
    asp.net 初识
    .net 中ashx文件的应用理解
    记录第一次给linux配置网络,在虚拟机中连接真实网络
    linux 常用命令
    oracle 建分区表,时间自增
    python(9)- python基础知识刷题
    孤荷凌寒自学python第123天区块链037以太坊的 erc20代币07
  • 原文地址:https://www.cnblogs.com/handsomehan/p/5373128.html
Copyright © 2011-2022 走看看