Link to home
Start Free TrialLog in
Avatar of MMsabry
MMsabry

asked on

Who to unselect all checkboxes

Hi, I would like to have button on a page (contains a table with each row has a checkbox) that deselect all checked boxes
thanks
Avatar of kkhipple
kkhipple

try this...this code allows you to check and uncheck all checkboxes

<!--- place above checkbox--->
<SCRIPT>
function checkBoxes (form, check) {
var flagThis = false;
  for (var c = 0; c < form.elements.length; c++)
      flagThis = false;
      if (form.elements[c].type == 'checkbox')
        form.elements[c].checked = check;
        flagThis = true;
      if (flagThis)
        form.elements[c].checked = enabled;
}
</SCRIPT>


<!--- to check all checkboxes --->
<INPUT TYPe="CHECKBOX" NAME="applyToAll" ONCLICK="checkBoxes(this.form, this.checked)" VALUE="yes">




Avatar of MMsabry

ASKER

thank, but what do you mean by : <!--- place above checkbox--->, you meant place in the head of the page, right?
yes that's whta i meant....

Avatar of MMsabry

ASKER

Nope did not work!
ASKER CERTIFIED SOLUTION
Avatar of kkhipple
kkhipple

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MMsabry

ASKER

thanks, second code works fine, and nope I did not install SP2 yet, I'm in the middle of a project, not taking any risks.
now, this works fine to select all but to if i select a few and want to deselect them, i have to click your check box twice!
is there a way around this?
thanks
Try kkhipple code. And assign your points to him. That works.
Avatar of MMsabry

ASKER

hiranmaya, "YES, Sir"!!!!