1 Answer(s)      8 years ago
Posted in : Struts


View Answers

December 6, 2008 at 3:19 AM

Hi friend,

Code to solve the problem :

<TITLE>Check/Uncheck All Checkbox</TITLE>


<!-- Begin
function checkAll(field)
for (i = 0; i < field.length; i++)
field[i].checked = true ;

function uncheckAll(field)
for (i = 0; i < field.length; i++)
field[i].checked = false ;



<form name="myform" action="checkboxes.asp" method="post">
<b>Your Favorite Scripts & Languages</b><br>
<input type="checkbox" name="list" value="1">Java<br>
<input type="checkbox" name="list" value="2">Javascript<br>
<input type="checkbox" name="list" value="3">Active Server Pages<br>
<input type="checkbox" name="list" value="4">HTML<br>
<input type="checkbox" name="list" value="5">SQL<br>

<input type="radio" name="radioCheck" value="Check All"
onClick="checkAll(document.myform.list)">Check All
<input type="radio" name="radioCheck" value="Uncheck All"
onClick="uncheckAll(document.myform.list)">Uncheck All



Related Tutorials/Questions & Answers:
multiboxes - Struts
multiboxes  I have a program that has an array of multiboxes and 2 radio buttons(checkall & uncheckall)... When i check 'checkall' all checkboxes are checked but when i click on uncheck it does nothing(The uncheck radio button