RE: [PHP] php + javascript hard day together ?
| From: | Ford, Mike [LSS] | Date: | Tue, 16 Jul 2002 14:32:42 +0000 |
| Subject: | RE: [PHP] php + javascript hard day together ? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-107877@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: David D [mailto:dd@asi.fr]
> Sent: 13 July 2002 16:38
>
> I can manage this script to work.
> Js warn about listid[], he doesnt like [] in a var name !
> Php needs them to collect an array from form checkboxes.
>
>
> <form name=test action=check.php>
>
> <input type=button value="partout"
> onClick="this.value=check(this.form.listid[])"><br>
use this.form['listid[]']
It seems to be a very little known fact that, by definition, the JavaScript construct
x.y
is identical to
x['y']
so an extended accessor such as
w.x.y.z
could also be written equally validly in any of the following ways:
w.x.y['z']
w.x['y'].z
w['x'].y.z
w['x'].y['z']
w['x']['y'].z
and several other similar combinations!
(And, yes, that means that this['form']['listid[]'] should be valid, too!)
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211