The <!--HTML code fragment is as follows:-->
Copy Code code as follows:
<div id= "Div1" >
<input type= "checkbox" onclick= "selectcheckboxes (' Div1 ', this.checked)"/> Full selection <br/>
<input type= "checkbox"/><br/>
<input type= "checkbox"/><br/>
<input type= "checkbox"/><br/>
</div>
<br/>
<div id= "Div2" >
<input type= "checkbox" onclick= "selectcheckboxes (' Div2 ', this.checked)"/> Full selection <br/>
<input type= "checkbox"/><br/>
<input type= "checkbox"/><br/>
<input type= "checkbox"/><br/>
</div>
<!--JS Code snippet is as follows:-->
Copy Code code as follows:
<script type= "Text/javascript" >
function Selectcheckboxes (domid,value) {
var inputs = document.getElementById (Domid). getElementsByTagName ("input");
for (var i = 0; i < inputs.length; i++) {
if (Inputs[i].type = = ' checkbox ') {
Inputs[i].checked=value;
}
}
}
</script>
Put the above code in the body can be.