Copy Code code as follows:
<script>
function func () {
var options=document.getelementsbyname ("Chkbox");
for (Var i=0;i<options.length;i++) {
if (!options[i].disabled) {
Options[i].checked=true;
}
}
}
</script>
<input Type=checkbox Name=chkbox value=1 disabled>
<input Type=checkbox Name=chkbox value=1>
<input Type=checkbox Name=chkbox value=1>
<input Type=checkbox Name=chkbox value=1>
<input Type=button value= "test" onclick= "func ()" >
Use JavaScript.
Copy Code code as follows:
<body>
<script>
function kk () {
var handleel = document.getElementById ("Kkhandler");
var els = document.getelementsbyname ("KK");
for (i=0;i<els.length;i++) {
els[i].checked = handleel.checked;
}
}
</script>
<input type=checkbox onclick= "KK ()" Name= "Kkhandler" > Full selection <br>
<input type=checkbox name= "KK" >
<input type=checkbox name= "KK" >
</body>
2:
Copy Code code as follows:
<form name= "form" id= "Form1" >
<input type= "checkbox" Name= "id" value= "id=" Checkbox1 ">1"
<input type= "checkbox" Name= "id" value= "id=" Checkbox2 ">2"
<input type= "checkbox" Name= "chose" value= "" onclick= "SelectAll ()" id= "Checkbox5" >allselect
</form>
<script>
function SelectAll ()
{
if (!document.form.id.length) {
if (document.form.chose.checked) {
Document.form.id.checked=true;
}
else{
Document.form.id.checked=false;
}
}
else{
for (Var i=0;i<document.form.id.length;i++) {
if (document.form.chose.checked) {
Document.form.id[i].checked=true;
}
else{
Document.form.id[i].checked=false;
}
}
}
}
</script>
3:
Copy Code code as follows:
<input type= ' checkbox ' name= ' info ' value= ' a ' >
<input type= ' CheckBox ' name= ' info ' value= ' B ' >
<input type= ' checkbox ' name= ' info ' value= ' C ' >
<input type= ' checkb Ox ' name= ' info ' value= ' d ' >
<input type= ' checkbox ' name= ' info ' value= ' e ' ><br>
<input ' bu Tton ' value = ' All selected ' onclick= ' Check_all (); ' >
<script>
Function Check_all () {
arr = document.getelementsbyname (' info ');
for (i=0;i<arr.length;i++) {
arr[i].checked = true;
}
}
</script>