<input type="checkbox" class="form-control" id="checkAll" οnclick="CheckboxAll()"/>
<input type="checkbox" class="form-control checkbox" />
<input type="checkbox" class="form-control checkbox" />
<input type="checkbox" class="form-control checkbox" />
<input type="checkbox" class="form-control checkbox" />
..............
<script>
//全選和全不選
function CheckboxAll(){
var checkAll = document.getElementById("checkAll");
var checkInput = document.getElementsByClassName("checkbox");
if(checkAll.checked){
for(var i=0;i<checkInput.length;i++){
checkInput[i].checked = true;
}
}else{
for(var i=0;i<checkInput.length;i++){
checkInput[i].checked = false;
}
}
}
</script>