yep.... I did one this morning...... :-p cheers
-----Original Message----- From: Steve D [mailto:steve@;satachi.com] Sent: 22 October 2002 11:35 To: [EMAIL PROTECTED] Subject: RE: [ cf-dev ] Checkboxes javascript ... function checkAll(theForm) { for (i=0,n=theForm.elements.length;i<n;i++) if (theForm.elements[i].name.indexOf('chkmsg') !=-1) theForm.elements[i].checked = true; } function UNcheckAll(theForm) { for (i=0,n=theForm.elements.length;i<n;i++) if (theForm.elements[i].name.indexOf('chkmsg') !=-1) theForm.elements[i].checked = false; } and .... <INPUT TYPE="checkbox" NAME="chkmsg" onClick="if (this.checked) {checkAll(this.form);} else {UNcheckAll(this.form);}"> ... in your checkboxes. > -----Original Message----- > From: Robertson-Ravo, Neil (REC) > [mailto:Neil.Robertson-Ravo@;csd.reedexpo.com] > Sent: 21 October 2002 20:38 > To: '[EMAIL PROTECTED]' > Subject: [ cf-dev ] Checkboxes > > > Hi Guys, > > I have this code which checks all checkboxes in a form : > > function checkAll(theForm) { > for (i=0,n=theForm.elements.length;i<n;i++) > if (theForm.elements[i].name.indexOf('chkmsg') !=-1) > theForm.elements[i].checked = true; > } > > I then call it via another checkbox : > > <input type="checkbox" onClick="if (this.checked) > checkAll(this.form);"> > > This all works AOK except that I am missing the code to > uncheck them!!! Can anyone point me in the right direction > with a solution?! I am sure its fairly simple, but I just > cant see it as of yet :-( > > I want it to work on a checkbox and not on an image like many > solutions have ! any idea? > > N > > > > -- > ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ > > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] For human help, e-mail: > [EMAIL PROTECTED] > -- ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] For human help, e-mail: [EMAIL PROTECTED] -- ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] For human help, e-mail: [EMAIL PROTECTED]
