logo       

Re: Form images don't appear in form.elements: msg#00040

mozilla.devel.dom

Subject: Re: Form images don't appear in form.elements

Howard Jess wrote:
> Apparently, form elements of type
>
> <input type="image" src="...>
>
> are not included in the form's elements[] collection.
>
> I don't understand why not; according to DOM2, all form
> control elements in the form are part of the elements
> collection.

They don't always not appear in the elements collection, but it would be
reasonable to say that it would not be a good idea to expect to be able
to find them there (as they commonly will not be present).

> Further, this element doesn't appear in the (DOM0)
> document.images collection either;

It would be unexpected for them to appear in - document.images - as it
is explicitly a collection of IMG elements, no elements that happen to
be displaying images (such as maybe OBJECT).

> so it's really not well-accounted for.

It is certainly a unhelpful peculiarity where forms are concerned.

<snip>
> Is there an explanation for this, or was this behavior
> chosen strictly to mimic Internet Explorer's behavior?
> Or, am I doing something wrong?
<snip>

I think you will find that this behaviour originates with a Netscape
browsers. Netscape 4 had no means of referencing these elements (as they
did not even support event handlers), and that may have also been true
for earlier versions (thus pre-dating scriptable IE versions).

Richard.


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise