62,272
社区成员
发帖
与我相关
我的任务
分享
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>checkbox</title>
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#checkall").click(function(){
$("[type=checkbox]").each(function(){
if($(this).attr("checked"))
$(this).attr("checked","");
else
$(this).attr("checked",true);
});
$("#nocheck").attr("checked","");
})
})
</script>
</head>
<body>
<input id="checkall" type="checkbox" />全选
<input type="checkbox" />1
<input type="checkbox" />2
<input type="checkbox" />3
<input type="checkbox" />4
<input type="checkbox" />5
<input type="checkbox" />6
<input type="checkbox" />7
<input type="checkbox" />8
<input type="checkbox" />9
<input type="checkbox" />10
<input id="nocheck" type="checkbox" />不让我选中
</body>
</html>