[thelist] Problem accessing for values with []
Christian Heilmann
lists at onlinetools.org
Thu Feb 10 18:09:08 CST 2005
thelist at cjmarsh.com wrote:
>>>I'm on to my second odd problem! I've got a javascript file
>>>
>>>
>>that needs
>>
>>
>>>to make reference to the following form:
>>>document.myform.form[fieldname].value
>>>
>>>But:
>>>alert('val: ' + document.main.form[journal].value);
>>>
>>>
>
>Should that not be:
>
>alert('val: ' + document.main.form['journal'].value);
>
>Regards
>
>
Have you tried it? The first wrong example is looking for a main
object in the document object, and an array form in that one. then it
tries to read the value of the elment of that form with the index
journal. Your example gets at least the associative array syntax right,
but has nothing to do with the forms array either.
More information about the thelist
mailing list