Html,javascript How to control the check box checkbox of the full selection, all unselected, and all selected, select All buttons, one or more of the unselected, the Select All button is not selected

Source: Internet
Author: User

<%@ Page Language="java" contentType="text/html; Charset=utf-8 "
pageencoding="UTF-8"%>
<%@ include file="/commons/jsp/htmtag.jsp"%>

<meta http-equiv= "content-type" Content="text/html; Charset=utf-8 ">
<title></title>
<script>

When the Select All button is selected, all check boxes are selected, and when the Select All button is not selected, all are not selected.
functionFunselall(){
VarSelects=Document.Getelementsbyname("Selone");
If(Document.Getelementsbyname("Selall")[0].Checked==True){
For(VarI=0;I<Selects.Length;I++){
Selects[I].Checked=True;
}
}Else{
For(VarI=0;I<Selects.Length;I++){
Selects[I].Checked=False;
}
}
}
When all checkboxes are selected, the Select All button is selected, and when any or more of them are not selected, the Select All button is not selected
functionFunselone(){
VarOne=Document.Getelementsbyname("Selone");
VarAll=Document.Getelementsbyname("Selall")[0]
VarSelcount=0;
VarUnselcount=0;
For(VarI=0;I<One.Length;I++){
If(One[I].Checked==True){
Selcount++;
}
If(One[I].Checked==False){
Unselcount++;
}
if (selcount==one< Span class= "pun". length) {
  all. Checked=true  }
 if ( unselcount>0) {
  all.=false  }
}
}

functionFundelbatch(){
VarStrsvalue="";
VarSTRs=Document.Getelementsbyname("Selone");
If(STRs!=Null&&STRs.Length>0){
For(VarI=0; I<strs.; I++) {
//----
if ( strs[i]. Checked==true) {
strsvalue =strsvalue+strs[< Span class= "PLN" >i. value+
//---

}
}
Document.Form1.Action="<%=request.getcontextpath ()%>/grade/allgrades.htm?method=todetailgradebatch&gradeids="+Strsvalue;
Document.Form1.Submit();
}
</script>
<body>
<!--todetailgradebyname-->
<form action= "<%=Request.Getcontextpath()%>/grade/allgrades.htm?method=todetailgradebyname "method=" Post "id=" Form1 "Name=" Form1 ">
<div Align="Center">
<input type= "text" name= "gradename" value= "${gradename}" >
<input type= "submit" value = "query" >
<input type= "reset" value= "reset" >
<br/

<br/>
<input Type="Button" Value=Add OnClick="Window.Open(' Http://localhost:8080/demo/jsp/grade/gradeAdd.jsp ');">
<input Type="Button" Value="Bulk Delete" OnClick="Fundelbatch()">
</div>
<table Border="1px"Align="Center" Border="1" cellpadding="2" CellSpacing="0" Bordercolorlight="#000000" Bordercolordark="#FFFFFF" BgColor="#FFFFEE">
<c:if Test="${not Empty ' ${volists} '}">
<tr>
<td><input Type="checkbox" Name="Selall" OnClick="Funselall(This)"></td>
<td>Class Code</td>
<td>Class name</td>
<td>Operation</td>
</tr>
<c:foreach Items="${volists}" Var="Vo">
<tr>
<td><input Type="checkbox" Name="Selone" Value="${vo.gradeid}" OnClick="Funselone(This)"></td>
<td>${vo.gradeid}</td>
<td>${vo.gradename}</TD>
<TD>
<a href= " <%=request. () %>/grade/allgrades.htm?method=todeletegrade&gradeid =${vo.gradeid} "> Delete </A>
<a href=" <%=< Span class= "PLN" >request. () %>/grade/allgrades.htm?method=todetailgrade&gradeid =${vo.gradeid} "> Modify </A>
</TD>
</ Tr>
</C:FOREACH>
</C:IF>
</ Table>
</FORM>

</body>

Html,javascript How to control the check box checkbox of the full selection, all unselected, and all selected, select All buttons, one or more of the unselected, the Select All button is not selected

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.