note 34993 deleted from language.types.array by didou
| From: | didou@php.net | Date: | Thu, 14 Aug 2003 13:06:59 +0000 |
| Subject: | note 34993 deleted from language.types.array by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-54159@lists.php.net to get a copy of this message | ||
Note Submitter: paul.php@burney.ws
----
Yet another way to use JavaScript to access form elements that use PHP's (ugly) way of getting
arrays from browsers. This code specifically can be used to do things like have a "check
all" link:
<input type="checkbox" name="array1[]" value="a"> a
<input type="checkbox" name="array1[]" value="b"> b
<input type="checkbox" name="array1[]" value="c"> c
<input type="button" value="Check/Uncheck All" onclick="
myset = getElementsByName('array1[]');
for (var i = 0; i < myset.length; i++) {
myset[i].checked = !myset[i].checked;
}
">
Tested and working in Mozilla 1.4 Mac/PC, IE 5 Windows, IE 5 Mac, Safari, and iCab.