XML DOM value အချက်အလက်
ဒီပညာ
value
အချက်အလက် ကို ပြန်လည်ပေးသည်。
လက္ခဏာ
attrObject.value
အကြောင်းအရာ
အောက်ပါ ကြောင်းရာ ကို "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].name + " = " + x.item(i).attributes[0].value + "
"; } document.getElementById("demo").innerHTML = txt; }