From: Garrett Smith on
FAQ server wrote:
> -----------------------------------------------------------------------
> FAQ Topic - My element is named myselect[], how do I access
> it?
> -----------------------------------------------------------------------
>
> Form controls with any "illegal" characters can be accessed with
> ` formref.elements["myselect[]"] ` - The bracket characters,
> amongst others, are illegal in ID attributes and javascript
> identifiers, so you should try to avoid them as browsers may
> handle them incorrectly.
>
> http://msdn.microsoft.com/en-us/library/ms537449%28VS.85%29.aspx
>
> http://docs.sun.com/source/816-6408-10/form.htm
>
How about a replacement:
https://developer.mozilla.org/en/DOM/form

> http://jibbering.com/faq/notes/square-brackets/
>

That faq note provides the example:

| var stringOfValue = document.formName.inpName.value;

That is nonstandard and can result in a leaked form control. HTML 5
terms this as some sort of feature.

How about:
| var stringOfValue = document.forms.formName.elements.inpName.value;

?

Although standard form control access is not the point of the article,
the examples should not propose the reader to use non-standard access.
Considering this is linked from an entry on how to access a named form
control, it has the effect of advocating non-standard code.
--
Garrett
comp.lang.javascript FAQ: http://jibbering.com/faq/