एक्सएमएल डोम मालिक तत्व संपत्ति
Attr वस्तु
उदाहरण
निम्न कोड खंड " books.xml " को xmlDoc में लोड करता है और तत्व नोड देता है जिसमें पहली श्रेणी विशेषता संलग्न होती है:
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');
document.getElementById("demo").innerHTML =
x.item(0).attributes[0].ownerElement
+ "<br>" +
x.item(0).attributes[0].ownerElement .nodeName
+ "<br>" +
x.item(0).attributes[0].ownerElement .nodeType;
}
उपरोक्त कोड का आउटपुट होगा:
[object Element]
book
1
परिभाषा और उपयोग
मालिक एलीमेंट गुण उस तत्व नोड को लौटाता है जिससे विशेषता जुड़ी हुई है।
वाक्य - विन्यास
attrObject.ownerElement
Attr वस्तु