当前位置:首页 » JavaScript » js实现多个复选框的全选与取消
js实现多个复选框的全选与取消
来自:新思网络时间:2012-05-23 15:15:02

   

 

<script type="text/javascript">
//控制是否全选
function isSelectAll(){
var  isSelected  =   document.getElementById("allselect").checked; 
var checkBoxArray = document.getElementsByName("selectedCheckBox"); 
if(isSelected){
for (var i = 0; i < checkBoxArray.length; i++) {
        checkBoxArray[i].checked = true;
}
}
else{
for (var i = 0; i < checkBoxArray.length; i++) {
checkBoxArray[i].checked = false;
}
}
}
</script>
关键词:JavaScript,复选框