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>
    

      

  • 相关阅读:
    iOS开发UI篇—控制器的View的创建
    iOS开发UI篇—控制器的创建
    OS开发UI篇—UIWindow简单介绍
    iOS开发UI篇—使用storyboard创建导航控制器以及控制器的生命周期
    A1089. Insert or Merge
    A1044. Shopping in Mars
    A1010. Radix
    A1085. Perfect Sequence
    散列、贪心总结
    A1038. Recover the Smallest Number
  • 原文地址:https://www.cnblogs.com/handsomehan/p/5373128.html
Copyright © 2011-2022 走看看