Effect: Code: Copy code The code is as follows: <br> window.onload = function () {<br> var ckall = document.getElementById ('ck1');<br> var ck = document.getElementsByName('name1');<br> ckall.onclick = function () {<br> var ck = document.getElementsByName('name1'); i ) {<br> if (ckall.checked == true) {<br> ck[i].checked = true;<br> }<br> else {<br> > ><br> <form id="form1" runat ="server"><br> ="checkbox" name="name1" /><br> ; <br> & lt; input type = "checkbox" name = "name1" /& gt; <br> & lt; input type = "checkbox" name = "name1" /& gt; <br> & lt; checkbox "name ="name1" /><br> </div><br> </form><br></body><br><br><br> </div>