<!doctype html> |
|
lang= "en" > |
|
|
|
<meta charset= "UTF-8" > |
|
<meta name= "Generator" content= "editplus®" > |
|
<meta name= "Author" content= "" > |
|
<meta name= "Keywords" content= "" > |
|
<meta name= "Description" content= "" > |
|
<title>document</title> |
|
|
|
<script> |
|
function Checkall (booleanvalue) |
|
{ |
|
var checkboxset= document.getelementsbyname ("hobby"); |
|
for (var i =0;i<checkboxset.length; i++) |
|
{ |
|
checkboxset[i].checked = Booleanvalue; |
|
} |
|
|
|
} |
|
|
|
function Reversecheck () { |
|
|
|
Find all the checkboxes |
|
For each checkbox, the current checked attribute is judged, and the inverse |
|
|
|
var checkboxset= document.getelementsbyname ("hobby"); |
|
for (var i =0;i<checkboxset.length; i++) |
|
{ |
|
checkboxset[i].checked =!checkboxset[i].checked; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
</script> |
|
|
|
|
|
|
|
<body> |
|
|
|
|
|
Select All/Uncheck <input type= "checkbox" name= "Hobbys" onclick= "Checkall (this.checked)"/> <br/> |
|
|
&NBSP; |
<input type= "checkbox" Span class= "Webkit-html-attribute-name" >name= "hobby" value=" football "onclick=" "/> Soccer |
&NBSP; |
<input type= "checkbox" Span class= "Webkit-html-attribute-name" >name= "hobby" value=" basketball "onclick=" "/> Basketball |
&NBSP; |
<input type= "checkbox" Span class= "Webkit-html-attribute-name" >name= "hobby" value=" swim "onclick=" "/> Swim |
|
<input type= "checkbox" name= "hobby" value= "singing" onclick= ""/> Singing <br/ > |
|
|
&NBSP; |
<input type= "button" value= " Select all" onclick=" checkall (True) "/> <input type= " button "value=" All not selected" onclick= "checkall (False)"/> |
|
<input type= "button" value= " reverse selection" onclick= "reversecheck ()"/> |
|
</body> |
|
|
|
</body> |
|
|
|
The Checkmeonly function DOM is implemented in the demo program of all-in-selection in JavaScript