XML DOM isId Property
❮ Attr Object
ဥပမာ
အောက်ပါ ကုဒ်အပိုင်းအစသည် " books.xml " ကို xmlDoc သို့ တင်ပြီး အမျိုးအစား ရည်ညွှန်းချက်သည် <book> ဒြပ်စင်၏ ID ရည်ညွှန်းချက် ဟုတ်မဟုတ် ပြန်ပေးသည်-
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].isId + "<br>";
}
document.getElementById("demo").innerHTML = txt;
}
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
ရည်ညွှန်းချက်တစ်ခုသည် အမျိုးအစား ID ဖြစ်သည် (ဥပမာ ၎င်း၏ပိုင်ရှင်ဒြပ်စင်အတွက် identifier တစ်ခုပါရှိသည်) မဟုတ်ပါက ရည်ညွှန်းချက်တစ်ခုသည် မှားယွင်းကြောင်း ပြန်ပို့မည်ဆိုပါက isId ပိုင်ဆိုင်မှုသည် မှန်ပါသည်။
အထားအသို
attrObject.isId
❮ Attr Object