复选框一键全选(练习)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<input type="checkbox"><br><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>
<input type="checkbox"><br>
<input type="checkbox"><br>
<input type="checkbox"><br>
<script>
var a=document.getElementsByTagName("input")
a[0].onclick=function(){
for(var i=1;i<a.length;i++){
a[i].checked=this.checked;
}
}
</script>
</body>
</html>