一行代码搞定checkbox全选和全不选
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
	</head>
	<body>
		<div id="check">
			<input type="checkbox" onclick="checkAll(this)">全选<br><br>
			<input type="checkbox">1<br>
			<input type="checkbox">2<br>
			<input type="checkbox">3<br>
			<input type="checkbox">4<br>
			<input type="checkbox">5<br>
			<input type="checkbox">6<br>
			<input type="checkbox">7<br>
			<input type="checkbox">8<br>
			<input type="checkbox">9<br>
		</div>
	</body>
	<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
	<script type="text/javascript">
		function checkAll(obj) {
			$("#check input[type='checkbox']").prop('checked', $(obj).prop('checked'));
		}
	</script>
</html>
 
                    
                     
                    
                 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号