XML DOM hasAttributes() metodu

Tanım ve Kullanım

Eğer mevcut element düğümü herhangi bir özellikse, hasAttributes() true döner, aksi takdirde false döner.

Gramer:

hasAttributes()

Örnek

Tüm örneklerde XML dosyasını kullanacağız books.xmlve JavaScript fonksiyonları loadXMLDoc()

Aşağıdaki kod parçası "books.xml" dosyasındaki ilk <book> elementinin özelliklere sahip olup olmadığını kontrol eder:

xxmlDoc=loadXMLDoc("books.xml");
x=xmlDoc.getElementsByTagName('book')[0];
document.write(x.hasAttributes());

Yukarıdaki kodun çıktısı:

true