This will check or clear all of the checkboxes within a form.  If you had
multiple groups of checkboxes in the form (and only wanted to check/clear a
single set), you'd need to add logic to also test the form field names.

<script language="JavaScript">
function SelectAll() {
  for (var i=0; i < document.myform.elements.length; i++) {
    if (document.myform.elements[i].type == "checkbox") {
      document.myform.elements[i].checked = true
    }
  }
}

function ClearAll() {
  for (var i=0; i < document.myform.elements.length; i++) {
    if (document.myform.elements[i].type == "checkbox") {
      document.myform.elements[i].checked = false
    }
  }
}
</script>


----- Original Message -----
From: "Brunt, Michael" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Thursday, March 07, 2002 4:52 PM
Subject: Need to be able to make checkboxes in a table driven by query out
put all selected or deselected with one button


> I have a query result set that is output to a table one table row for each
> query row.  The numbers of rows returned depends on the query so is
dynamic.
> The first element in the table row is a checkbox and I need to enable
users
> to select or deselect all rows by clicking on a button at the foot of the
> page.  I looked around and found JavaScript that can work with static
> checkboxes with a fixed number.  Is there anything out there to do this
with
> dynamically generated result sets?
>
> Mike Brunt
______________________________________________________________________
Get Your Own Dedicated Windows 2000 Server
  PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation � $99/Month � Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionb
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to