note 32620 deleted from language.types.array by alindeman

From: Date: Tue, 03 Jun 2003 12:43:53 +0000
Subject: note 32620 deleted from language.types.array by alindeman
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-49619@lists.php.net to get a copy of this message
Note Submitter: wayne@php247.com ---- For those of you who are having trouble getting the PHP arrays working with JavaScript to do a "check all", or "uncheck all" facility for checkboxes, use this code: function checkAll() { boxlist = document.forms.MyFormName.elements["MyArray[]"]; for (i = 0; i < boxlist.length; i++) boxlist[i].checked = true; } function uncheckAll() { boxlist = document.forms.MyFormName.elements["MyArray[]"]; for (i = 0; i < boxlist.length; i++) boxlist[i].checked = false; } Here's an example of how to use the functions: <INPUT TYPE="button" onClick="checkAll()" VALUE="Check All"> <INPUT TYPE="button" onClick="uncheckAll()" VALUE="Uncheck All"> This will check, or uncheck, all of the checkboxes identified by the variable name MyArray[] on a form named MyFormName. Replace MyArray[] and MyFormName with whatever your own form and variable names are. Enjoy !

« previous php.notes (#49619) next »