jQuery 复习之复选框 简洁代码
<html>
<head>
<script src='js/min.js'></script>
<script src='js/select.js'></script>
</head>
<body>
<input type="checkbox" name="check" value="a"/>a
<input type="checkbox" name="check" value="b"/>b
<input type="checkbox" name="check" value="c"/>c
<input type="button" value="全选" id="checkAll"/>
<input type="button" value="全不选" id="checkNo"/>
<input type="button" value="反选" id="checkRevers"/>
</body>
</html>
$(function(){
$('#checkAll').click(function(){
$(':checkbox').attr({'checked':true});
});
$('#checkNo').click(function(){
$(':checkbox').attr({'checked':false});
});
$('#checkRevers').click(function(){
$(':checkbox').each(function(){
$(this).attr({'checked':!$(this).attr('checked')});
});
});
})
补充:web前端 , JavaScript ,