Closed Bug 123829 Opened 23 years ago Closed 23 years ago

js: input type=image is unfindable via js code afaict

Categories

(Core :: DOM: Core & HTML, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: kitchen_506, Assigned: jst)

Details

Attachments

(1 file)

see attatched html file for sample code

basically, if you have an <input type=image ...> you can't find it in either the
form object nor the images array.  How would you find out about it via
javascript?  It's clearly there and usable....why can't JS see it?

this has been a problem since NS 4.x days, but is reproducable under mozilla
20020205 (0.9.8) and embeded gecko via galeon 1.0.3

btw, the submission form helper thing is still broken
Attached file js test case
added html test case demonstrating issue(s)
Confirming with WinNT trunk build 20020204xx; OS: Linux --> All.
Reassigning to DOM Level 0.
Assignee: rogerl → jst
Status: UNCONFIRMED → NEW
Component: JavaScript Engine → DOM Level 0
Ever confirmed: true
OS: Linux → All
QA Contact: pschwartau → desale
This is as designed, IE and 4x work exactly like this, and we can't change this.
Changing this would break existing web pages that rely on this not working,
trust me, we've been there. The <input type=image> is findable in the DOM
through the normal lookup methods like document.getElementById() if you give it
an id, or document.getElementsByName() if you give it a name, or
document.getElementsByTagName('input')...

WONTFIX.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → WONTFIX
as a final parting shot for any who come looking for this, the solution I found
that more or less gave me what I wanted was:

function bytagname(f)
{
  str = 'Tag elements:\n'
  iitags = f.getElementsByTagNameNS('*', '*');
  for (i=0; i < iitags.length; i++) 
  {
    if (iitags[i].type)  // crude scan for 'formish' elements
    {
      str += '[' + i + ']: ' + iitags[i].type + ' ' + 
        iitags[i].value + ' ' + iitags[i].src + '\n';
    }
  }
  alert(str);
}

where f is a form element.

Thanks for the tip on the element.getElementBy...() functions
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: