复选框取消/全选

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>复选框全选/取消</title>
<script src="jquery-1.7.1.min.js"></script>
<script>
   function allcheck(){
        if($(":checkbox").attr("checked")!="checked"){
                $(":checkbox").attr("checked","checked");
            }else{
                   $(":checkbox").removeAttr("checked");
                }
	}


</script>
</head>
<body>
  <input type="checkbox" id="checkbox" name="checkbox"/>PHp<br/>
  <input type="checkbox" id="checkbox" name="checkbox"/>java<br/>
  <input type="checkbox" id="checkbox" name="checkbox"/>javascript<br/>
  <input type="checkbox" id="checkbox" name="checkbox"/>mysql<br/>
  <input type="checkbox" id="checkbox" name="checkbox"/>thinkphp<br/>
  <input type="button" value="全选" id="button" onclick="allcheck();"/>
</body>
</html>



你可能感兴趣的:(html,mysql,javascrip)