标签:
-----------------------------html-----------------------------------------
<input type="checkbox" name="test"/>1
<input type="checkbox" name="test"/>2
<input type="checkbox" name="test" />3
<input type="checkbox" name="test" />4
<input type="checkbox" name="test" />5
<input type="checkbox" id="chooseall" onclick="selectAll()"/>全选
-------------------------js-----------------------------------
var chooseall=document.getElementById("chooseall"),
mytest=document.getElementsByName("test"),
leng=mytest.length;
function selectAll(){
if(chooseall.checked==true){
for(i=0;i<leng;i++){
mytest[i].checked=true;
}
}else{
for(i=0;i<leng;i++){
mytest[i].checked=false;
}
}
}
标签:
原文地址:http://www.cnblogs.com/sisi2020/p/5234294.html