473,397 Members | 2,116 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

INPUT type=image in IE

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

Jul 23 '05 #1
1 4105


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

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mark | last post by:
Hi, I create a button in the form in the asp page like is: <input type="image" src="button.gif" name="detail" border=0 value="100234"> How can I get this value from another page? I try sdetail...
4
by: Csaba2000 | last post by:
I want to be able to programatically click on the center of an <INPUT type=image ...> element (I only care about IE 5.5+). This should work regardless of whether IE has focus. Normally you would...
1
by: Wayne | last post by:
Please help... For some odd reason onclick is not working with and <input type="image"> but works fine on an <input type="button">.... This does not work: <input TYPE="image" src="go.gif"...
2
by: Kimmo R. M. Hovi | last post by:
Currently I have defined: -- clip clip -- <form method="post" action="xx" enctype="application/x-www-form-urlencoded"> <input type="image" name="Function 1" src="image1.gif" border="0"...
7
by: b2b2u | last post by:
I can't seem to get a form to submit using an image !? <input type="image" src="submit.gif"> Any body have this problem? Is it choking on the x/y coordinates? If so, what can be done about it?...
1
by: champ.supernova | last post by:
Hi, I have a form which has a few different submit links, all of type image. This is critcal to the operation of the form, as it relies on the image co-ords being passed to another page, the...
2
by: jon | last post by:
Hi This might be an easy one to answer but I have a web form in an ASP.NET 1.1 application with a hand-rolled HTML image button as follows which opens a help guide in a new window: <input...
3
by: jackiepatti | last post by:
QUESTION: I have a web page containing a form that contains an image instead of a submit button, e.g. <form name='myform' action='get' method='otherpage.asp'> <input type='image'...
8
by: John | last post by:
Hi Pasrt of HTML - <div class='button'><input type='image' src='/images/check1.jpg'></input></div> Part of CSS - ..button {background-image: url(/images/check1.jpg); background-repeat:
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.