XML DOM hasAttributes() मेथड
विभावना और उपयोग
यदि वर्तमान एलेमेंट नोड के किसी भी गुण के रूप में है hasAttributes()
यह मेथड खत्म करने के बाद true वापस करता है, अन्यथा false वापस करता है。
व्याकरण
hasAttributes()
उदाहरण
इस कोड में "books.xml" को xmlDoc में लोड किया जाएगा और पहले <book> एलेमेंट के किसी भी गुण की जाँच की जाएगी:
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(); }