<title> full selection and reverse selection </title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<script type= "Text/javascript" language= "JavaScript" >
--Column header full marquee clicked---
function Chkallclick (sonname, Cballid) {
var Arrson = Document.getelementsbyname (sonname);
var cball = document.getElementById (cballid);
var tempstate = cball.checked;
for (i = 0; i < arrson.length; i++) {
if (arrson[i].checked! = tempstate)
Arrson[i].click ();
}
}
--The subkey check box is clicked---
function Chksonclick (sonname, Cballid) {
var Arrson = Document.getelementsbyname (sonname);
var cball = document.getElementById (cballid);
for (var i = 0; i < arrson.length; i++) {
if (!arrson[i].checked) {
cball.checked = false;
Return
}
}
Cball.checked = true;
}
--Anti-select---
function Chkoppclick (sonname) {
var Arrson = Document.getelementsbyname (sonname);
for (i = 0; i < arrson.length; i++) {
Arrson[i].click ();
}
}
</script>
<body>
<form id= "Form1" runat= "Server" >
<input name= "Chkall" id= "Chkall" title= "Select All" onclick= "Chkallclick (' Chkson ', ' Chkall ')" type= "checkbox"/> Select all
<input name= "Chkopposite" id= "chkopposite" title= "reverse select" onclick= "Chkoppclick (' Chkson ')" type= "checkbox"/> Reverse Selection
<input type= "button" id= "Add" name= "Add" onclick= "Addtowish ()" value= "Add"/>
<br/>
<%for (int i = 0; i < ten; i++)
{%>
<input name= "Chkson" id= ' chkson<%=i+1%> ' type= "checkbox" value= ' <%=i+1%> ' onclick= ' ChkSonClick (' Chkson ', ' Chkall ') "/><%=i+1%>
<br/>
<%}%>
</form>
</body>
JavaScript Select all and reverse selection