Better solutions exist; see the user-contributed notes in the PHP manual:
http://www.php.net/manual/en/language.types.array.php
Of particular interest is this one by t dot kloppenburg at billiton dot de:
[snip]
>The solution? Use this:
>document.forms.FormNameHere.elements["Settings[Name]"].value
>"Settings[Name]" is looked up in the elements array, and is found... The
elements array
>is a hash, so strings can be used as keys!
which avoids ambiguity as well as keeping your forms from breaking if you
change them. There is also a note in there (somewhere) that says you can
reference form elements by an id="{whatever}" attribute as well, which can
be useful in some cases.
_________________________________
Nathaniel Price <np...@te...>
Webmaster
----- Original Message -----
From: "Ernest Beinrohr" <Er...@Be...>
To: "phplib-users" <php...@li...>
Sent: Tuesday, July 22, 2003 8:33 AM
Subject: SOLVED: Re: [Phplib-users] When [] in OOHForm element, cannot use
javascript
> Well, I've found out, direct addressing of elements which contains '['
> in their names cannot be done in javascript. However, one can use
> indirect addressing like document.form.elements[17], which isn't
> bulletproof, but it works.
>
> have a nice day
>
|