Brent wrote:
(see below)
Thanks, Brent, but that doesn't explain why this works:
form["thing_"+number+"_deluxe"].value = "joey";
but this doesn't work:
form.["thing_"+number+"_deluxe"].value = "joey";
Note the dot after form? If that dot is included, then an error is
generated. If the dot is omitted, the script works fine in NS4 and IE4.
According to the logic you gave me, I would think that the second example
would work, but not the first. In fact, it's the other way around. Seems
like the first [ takes the place of the dot.
????
Or did you explain that and I just didn't understand it?
Thanks,
Jack
> On 6 Nov 98, Jack Killpatrick wrote:
>
> > with a dot (.) after form, but I tried that and it didn't work. I guess
> > javascript replaces the first [ with a dot? If so, why doesn't
> it replace
> > the 2nd one? I tried:
> >
> > form["thing_"+number+"_deluxe"]value = "joey";
> >
> > with no dot after the ], but it generates an error. Hmm.
>
> Each successive dot means you're going farther down into the DOM: if you
> were referencing, say 'window.document.form6.text3.value', you'd be
> starting at the top of the DOM (the window); then moving to the
> document open in that window; down to a form named 'form6'; to a text
> field named 'text3'; and finally to the value of 'text3'. This
> is comparable
> to how C and Java maintain hierarchical relationships.
>
> The sqaure brackets, on the other hand, normally specify arrayed (and
> similar) objects within a given level of the DOM; so that in your
> example,
> the brackets denote 'window.document.[thing_1_deluxe].value',
> 'window.document.[thing_2_deluxe].value', etc, all of which are
> associated with the same form. That is, they occupy different
> locations in
> the same index that Javascript creates for that particular form.
>
> If the names of the form and its subsidiary elements are not correctly
> separated by dots showing their place in the DOM hierarchy, then you'll
> certainly get errors.
>
> - Brent "been staying up late reading JS manuals the past few
> weeks" Eades
> -----------
> Brent Eades, Almonte, Ontario
> E-mail: [EMAIL PROTECTED]
> [EMAIL PROTECTED]
> Town of Almonte site: http://www.almonte.com/
> Business site: http://www.federalweb.com
>
> ____________________________________________________________________
> --------------------------------------------------------------------
> Join The Web Consultants Association : Register on our web site Now
> Web Consultants Web Site : http://just4u.com/webconsultants
> If you lose the instructions All subscription/unsubscribing can be done
> directly from our website for all our lists.
> ---------------------------------------------------------------------
>
____________________________________________________________________
--------------------------------------------------------------------
Join The Web Consultants Association : Register on our web site Now
Web Consultants Web Site : http://just4u.com/webconsultants
If you lose the instructions All subscription/unsubscribing can be done
directly from our website for all our lists.
---------------------------------------------------------------------