Closed
Bug 174617
Opened 23 years ago
Closed 23 years ago
Name attribute not recognized by getElementById() method
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
VERIFIED
WONTFIX
People
(Reporter: lupufr, Assigned: jst)
References
()
Details
Attachments
(1 file)
833 bytes,
text/html
|
Details |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.1) Gecko/20020826
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.1) Gecko/20020826
Trying to get a reference with getElementById() method to an HTML form control
which doesn't an id attribute fails.
Name attribute is not recognized by getElementById() method in Mozilla (it is in
IE browsers).
Note that id can't be used instead of name to create key/value pairs when
submitting the form.
Reproducible: Always
Steps to Reproduce:
1. Create a form with a text input with only a name attribute
2. Try to get its value with getElementById() method
Actual Results:
Mozilla JavaScript Console gives you :
Error: myText has no properties
Source File: http://1ppl.free.fr/mozilla/mozilla01/
Line: 9
To Mozilla, control is not "named" until you add an id attribute to it.
Expected Results:
Should launch an alert with the text input value.
Please find an HTML test case at the following url :
http://1ppl.free.fr/mozilla/mozilla01/
Reporter | ||
Comment 1•23 years ago
|
||
Assignee | ||
Comment 2•23 years ago
|
||
IE is broken, getElementById() does exactly what the name says, anything else is
just wrong. WONTFIX.
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Resolution: --- → WONTFIX
Reporter | ||
Comment 3•23 years ago
|
||
Ok - Another browser wars thing to live with... It's just a useful feature even
it's not part of the "standard".
Thx.
Comment 4•23 years ago
|
||
Verified. If you want names, use document.getElementsByNames() which is part of
the DOM HTML spec.
http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-71555259
Status: RESOLVED → VERIFIED
Comment 5•21 years ago
|
||
*** Bug 269420 has been marked as a duplicate of this bug. ***
Comment 6•20 years ago
|
||
*** Bug 306784 has been marked as a duplicate of this bug. ***
Component: DOM: HTML → DOM: Core & HTML
QA Contact: stummala → general
You need to log in
before you can comment on or make changes to this bug.
Description
•