INPUT type=image in IE

B

Brian Genisio

Hi all,

I noticed that the image input type does not show up in the elements
array (IE 6.0).

<FORM name=myForm>
<INPUT name=rads id=check1 type=radio value=val1>
<INPUT name=rads id=check2 type=radio value=val2 checked>
<INPUT name=rads id=check3 type=radio value=val3>
<INPUT name=rads id=check4 type=radio value=val4>

<INPUT name=imgIn type=image src=web.gif>
<INPUT type=button name=somethin>
</FORM>

If I have this HTML code, the myForm.elements.length is 5, instead of
the expected 6. You can click on the image in this case, and it acts
like a submit button... proof that the broser recognizes it as part of
the form.

So, if I call myForm.elements[4], I get the button, not the image.

It seems goofy to me, and I cannot find any documentation that explains
why this is.

Of course, I can get access to the object in many other ways... I am
just curious if the is an IE bug.

Brian
 
M

Martin Honnen

Brian Genisio wrote:

I noticed that the image input type does not show up in the elements
array (IE 6.0).

<FORM name=myForm>
<INPUT name=rads id=check1 type=radio value=val1>
<INPUT name=rads id=check2 type=radio value=val2 checked>
<INPUT name=rads id=check3 type=radio value=val3>
<INPUT name=rads id=check4 type=radio value=val4>

<INPUT name=imgIn type=image src=web.gif>
<INPUT type=button name=somethin>
</FORM>

If I have this HTML code, the myForm.elements.length is 5, instead of
the expected 6. You can click on the image in this case, and it acts
like a submit button... proof that the broser recognizes it as part of
the form.

So, if I call myForm.elements[4], I get the button, not the image.

It seems goofy to me, and I cannot find any documentation that explains
why this is.

Of course, I can get access to the object in many other ways... I am
just curious if the is an IE bug.

Do you get a different result for Mozilla or Netscape browsers? I don't
think so. Somehow when Netscape 2 or 3 introduced the elements
collection for <form> element objects <input type="image"> elements were
not included and most browsers stick with that (odd) tradition. With
old Netscape's (2, 3, 4) the <input type="image"> was therefore not
scriptable at all but nowadays you can use getElementsByTagName or
getElementById to access it
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top