<! DOCTYPE html>
<meta charset= "Utf-8"/>
<title></title>
<script type= "Text/javascript" >
Window.onload=function () {
var Allselect=document.getelementbyid ("Allselect");
var Noselect=document.getelementbyid ("Noselect");
var Btn2=document.getelementbyid ("Btn2");
Get all the input tags
var Odiv=document.getelementbyid ("Chk");
var chks=odiv.getelementsbytagname ("input");
Allselect.onclick=function () {
for (Var i=0;i<chks.length;i++) {
Chks[i].checked=true; Select All
}
};
Noselect.onclick=function () {
All do not choose
for (Var i=0;i<chks.length;i++) {
Chks[i].checked=false;
}
};
Btn2.onclick=function () {
for (Var i=0;i<chks.length;i++) {
To reverse the selection
chks[i].checked=!chks[i].checked;
}
};
};</script>
<body>
<div id= "Top" >
</div><div id="container"> <input type="button" value="全选" id="allSelect"> <input type="button" value="反选" id="btn2"> <input type="button" value="不选" id="noSelect">
</body>
Use JS to achieve a full selection, inverse selection, all-in-all (button)