<!DOCTYPE Html>
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script type="text/javascript">
function selectAll(checkbox) {
$('input[type=checkbox]').attr('checked', $(checkbox).attr('checked'));
}
</script>
</head>
<body>
<input type="checkbox" onclick="selectAll(this);" />全选<br/>
<input type="checkbox" /><br/>
<input type="checkbox" /><br/>
<input type="checkbox" /><br/>
<input type="checkbox" /><br/>
<input type="checkbox" /><br/>
<input type="checkbox" /><br/>
</body>
</html>
04 |
function select_all(){ |
05 |
$( "input[name='id']" ).attr( "checked" , true ); |
09 |
function unselect_all(){ |
10 |
$( "input[name='id']" ).attr( "checked" , false ); |
14 |
function select_other(){ |
15 |
jQuery.each($( "input[name='id']" ), function (i, n){ |
16 |
n.checked = !n.checked; |