Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

XML DOM ownerElement Property

XML DOM ownerElement Property


Attr Object Reference Attr object


Definition and Usage

The ownerElement property returns the element node to which an attribute belongs.

Syntax

attrObject.ownerElement


Example

The following code snippet uses loadXMLDoc() to load "books.xml" Load into xmlDoc, and return the element node to which the first category element belongs:

Example

xmlDoc

=

loadXMLDoc

(

"

books.xml

"

)

;

x

=

xmlDoc

.

getElementsByTagName

(

'

book

'

)

;

document

.

write

(

x

.

item

(

0

)

.

attributes

[

0

]

.

ownerElement

)

;

document

.

write

(

"


"

)

;

document

.

write

(

x

.

item

(

0

)

.

attributes

[

0

]

.

ownerElement

.

nodeName

)

;

document

.

write

(

"


"

)

;

document

.

write

(

x

.

item

(

0

)

.

attributes

[

0

]

.

ownerElement

.

nodeType

)

;

The code above will output:

[object Element]

book

1

Try it »


Attr Object Reference Attr object