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: Thomas 'PointedEars' Lahn <PointedEars@web.de>
Date: Mon Jan 30 2006 - 14:23:58 CET

Jasen Betts wrote:

> On 2006-01-29, Thomas 'PointedEars' Lahn <PointedEars@web.de> wrote:
>> VK wrote:
>>> 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
>> The OP is trying to retrieve the `form' element's name, specified by
>> its `name' attribute.
> hmm...
>
> document.forms[0].attributes['name'].value

Nice one.
 
> or has someone already suggested that?

Not explicitly. formRef.attributes['name'] refers to the same object
formRef.getAttributeNode('name') or formRef.getAttributeNodeNS('', 'name')
refer to per _Gecko DOM_, whereas I suggested the last two already.
However, the former is worth another try.

PointedEars
Received on Tue Feb 7 21:27:17 2006