Re: check/uncheck checkboxes
Just make the image look like a checkbox, but I think the code I gave you will pretty much work with a check box too. Stephen - Original Message - From: Robertson-Ravo, Neil (REC) [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Monday, October 21, 2002 5:28 PM Subject: RE: check/uncheck checkboxes Is there one which uses a checkbox instead of an image/button? -Original Message- From: Stephen Moretti [mailto:stephen;cfmaster.co.uk] Sent: 21 October 2002 17:07 To: CF-Talk Subject: Re: check/uncheck checkboxes Neil, selectall = true; function checkAll(theForm) { if (selectall == true) { selectall = false; theForm.selectallbutton.src = selectall_off.gif; } else { selectall = true; theForm.selectallbutton.src = selectall_on.gif; } for (i=0,n=theForm.elements.length;in;i++) if (theForm.elements[i].name.indexOf('chkmsg') !=-1) theForm.elements[i].checked = selectall; } input name=selectallbutton type=image src=selectall_on.gif alt=Select All onClick=checkAll(this.form); The selectall variable goes in global Javascript space and I _think_ I have the code right for setting the selectallbutton image That should point you in the right direction. Regards Stephen ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm
RE: check/uncheck checkboxes
Could you just run the same code with false instead of true? Mark Stephenson New Media Director Evolution Internet T: 0870 757 1631 F: 0870 757 1632 W: www.evolutioninternet.co.uk E: [EMAIL PROTECTED] WARNING: --- The information contained in this document and attachments is confidential and intended only for the person(s) named above. If you are not the intended recipient you are hereby notified that any disclosure, copying, distribution, or any other use of the information is strictly prohibited. If you have received this document by mistake, please notify the sender immediately and destroy this document and attachments without making any copy of any kind. AVIS IMPORTANT: --- Les informations contenues dans le present document et ses pieces jointes sont strictement confidentielles et reservees a l'usage de la (des) personne(s) a qui il est adresse. Si vous n'etes pas le destinataire, soyez avise que toute divulgation, distribution, copie, ou autre utilisation de ces informations est strictement prohibee. Si vous avez recu ce document par erreur, veuillez s'il vous plait communiquer immediatement avec l'expediteur et detruire ce document sans en faire de copie sous quelque forme. -Original Message- From: Robertson-Ravo, Neil (REC) [mailto:Neil.Robertson-Ravo;csd.reedexpo.com] Sent: 21 October 2002 16:32 To: CF-Talk Subject: check/uncheck checkboxes Guys, I have this code which checks all checkboxes in a form : function checkAll(theForm) { for (i=0,n=theForm.elements.length;in;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 :-( Neil ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com
Re: check/uncheck checkboxes
Neil, selectall = true; function checkAll(theForm) { if (selectall == true) { selectall = false; theForm.selectallbutton.src = selectall_off.gif; } else { selectall = true; theForm.selectallbutton.src = selectall_on.gif; } for (i=0,n=theForm.elements.length;in;i++) if (theForm.elements[i].name.indexOf('chkmsg') !=-1) theForm.elements[i].checked = selectall; } input name=selectallbutton type=image src=selectall_on.gif alt=Select All onClick=checkAll(this.form); The selectall variable goes in global Javascript space and I _think_ I have the code right for setting the selectallbutton image That should point you in the right direction. Regards Stephen ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com
RE: check/uncheck checkboxes
Is there one which uses a checkbox instead of an image/button? -Original Message- From: Stephen Moretti [mailto:stephen;cfmaster.co.uk] Sent: 21 October 2002 17:07 To: CF-Talk Subject: Re: check/uncheck checkboxes Neil, selectall = true; function checkAll(theForm) { if (selectall == true) { selectall = false; theForm.selectallbutton.src = selectall_off.gif; } else { selectall = true; theForm.selectallbutton.src = selectall_on.gif; } for (i=0,n=theForm.elements.length;in;i++) if (theForm.elements[i].name.indexOf('chkmsg') !=-1) theForm.elements[i].checked = selectall; } input name=selectallbutton type=image src=selectall_on.gif alt=Select All onClick=checkAll(this.form); The selectall variable goes in global Javascript space and I _think_ I have the code right for setting the selectallbutton image That should point you in the right direction. Regards Stephen ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
RE: check/uncheck checkboxes
Use the two code samples below to call for Selecting and UN-selecting the checkboxes. // This function will CHECK all elements on the page function SelectAll() { var i=0; for( i=0 ; idocument.FileListing.elements.length; i++) { document.FileListing.elements[i].checked=1; } } // This function will UNCHECK all elements on the page function ClearAll() { var i=0; for( i=0 ; idocument.FileListing.elements.length; i++) { document.FileListing.elements[i].checked=0; } } === To call the SelectAll function: INPUT TYPE=button VALUE=Select All NAME=Select_All OnClick=SelectAll(); === To call the ClearAll function: INPUT TYPE=button VALUE=Clear All NAME=Clear_All OnClick=ClearAll(); [EMAIL PROTECTED] 10/21/02 12:28PM Is there one which uses a checkbox instead of an image/button? -Original Message- From: Stephen Moretti [mailto:stephen;cfmaster.co.uk] Sent: 21 October 2002 17:07 To: CF-Talk Subject: Re: check/uncheck checkboxes Neil, selectall = true; function checkAll(theForm) { if (selectall == true) { selectall = false; theForm.selectallbutton.src = selectall_off.gif; } else { selectall = true; theForm.selectallbutton.src = selectall_on.gif; } for (i=0,n=theForm.elements.length;in;i++) if (theForm.elements[i].name.indexOf('chkmsg') !=-1) theForm.elements[i].checked = selectall; } input name=selectallbutton type=image src=selectall_on.gif alt=Select All onClick=checkAll(this.form); The selectall variable goes in global Javascript space and I _think_ I have the code right for setting the selectallbutton image That should point you in the right direction. Regards Stephen ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm