Re: "getAttribute" returns a child element instead of ...?
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: "getAttribute" returns a child element instead of ...?

From: VK <schools_ring@yahoo.com>
Date: Sun Jan 29 2006 - 18:39:34 CET

Noa wrote:
> Is this what you meant? -> document.forms[0].name

See my post (""VK") again please:

document.forms[0].elements[0].name
   or
document.forms[0].elements['name'].name

> Because this does the exactly same thing as "getAttribute".... it
> returns the html input element and not the string with the value of the
> attribute....

Yes, and to complete the fun, you can add to your form
<input type="submit" name="submit" value="submit">

and now try document.forms[0].submit();

Conclusion:
1) do not name elements using property names as names. Are we short on
vocabulary? ;-)
2) do not try to explain form and form elements using DOM1 or DOM2.
This is a pre-historic construction kept for legacy requirements. Use
*form methods* for forms.

> And, an off-topic question - How do I report the bug ?

It is not a bug and I doubt very much that it will be ever fixed in the
way you want. But if it makes you feel better, you may complain to:

http://bugzilla.mozilla.org
http://support.microsoft.com/ph/2073
https://bugs.opera.com/wizard/

(ask for more when you are done with above).
Received on Tue Feb 7 21:26:39 2006