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

XML DOM isId Property

XML DOM isId Property


Attr Object Reference Attr object


Definition and Usage

The isId property returns true when the attribute is of type ID (for example, it contains the identifier of the element it belongs to), otherwise it returns false.

Syntax

attrObject.isId


Example

The following code snippet uses loadXMLDoc() to load "books.xml" Load into xmlDoc, and return whether the category attribute is the ID attribute of an element:

Example

xmlDoc

=

loadXMLDoc

(

"

books.xml

"

)

;

x

=

xmlDoc

.

getElementsByTagName

(

'

book

'

)

;

for

(

i

=

0

;

i

<

x

.

length

;

i

++

)

{

document

.

write

(

x

.

item

(

i

)

.

attributes

[

0

]

.

isId

)

;

document

.

write

(

"


"

)

;

}

The code above will output:

false

Try it »


Attr Object Reference Attr object