XML DOM hasAttributes() Yöntemi
❮ Düğüm Nesnesi
Örnek
Aşağıdaki kod parçası, " books.xml " dosyasını xmlDoc'a yükler ve ilk <book> öğesinin herhangi bir özniteliği olup olmadığını döndürür:
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
myFunction(this);
}
};
xhttp.open("GET", "books.xml", true);
xhttp.send();
function myFunction(xml) {
var xmlDoc = xml.responseXML;
var x =
xmlDoc.getElementsByTagName('book')[0];
document.getElementById("demo").innerHTML =
x.hasAttributes();
}
Çıktı:
true
Tanım ve Kullanım
hasAttributes() yöntemi , belirtilen düğümün herhangi bir niteliği varsa true , aksi takdirde false döndürür .
Not: Belirtilen düğüm bir Öğe düğümü değilse, dönüş değeri her zaman false olur .
Tarayıcı Desteği
hasAttributes() yöntemi, tüm büyük tarayıcılarda desteklenir.
Not: Internet Explorer 9 ve önceki sürümleri hasAttributes() yöntemini desteklemez.
Sözdizimi
nodeObject.hasAttributes()
parametreler
Hiçbiri.
Geri dönüş değeri
Type | Description |
---|---|
Boolean | Returns true if the specified node has any attributes, otherwise false |
Teknik detaylar
DOM Sürümü | Çekirdek Düzey 2 Düğüm Nesnesi |
---|
❮ Düğüm Nesnesi