एक्सएमएल डोम निर्दिष्ट संपत्ति
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 x, i, xmlDoc, txt;
xmlDoc = xml.responseXML;
txt = ""
x = xmlDoc.getElementsByTagName('book');
for (i = 0; i
< x.length; i++) {
txt +=
x.item(i).attributes[0].specified + "<br>";
}
document.getElementById("demo").innerHTML = txt;
}
आउटपुट:
true
true
true
true
परिभाषा और उपयोग
यदि विशेषता मान दस्तावेज़ में सेट किया गया है, और डीटीडी/स्कीमा में डिफ़ॉल्ट मान होने पर गलत है, तो निर्दिष्ट गुण सत्य लौटाता है।
वाक्य - विन्यास
attrObject.specified
Attr वस्तु