ویژگی XML DOM localName

تعریف و استفاده

localName ویژگی بازمی‌گردونه نام محلی ویژگی.

قواعد

attrObject.localName

مثال

مزید کد "books_ns.xml" کوچلایا xmlDoc میکشاد، و نام محلی ویژگی "lang" رو برمی‌گردونه:

var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
   if (this.readyState == 4 && this.status == 200) {
       myFunction(this);
   }
};
xhttp.open("GET", "books_ns.xml", true);
xhttp.send();
function myFunction(xml) {
    var x, i, xmlDoc, txt;
    xmlDoc = xml.responseXML;
    txt = "";
    x = xmlDoc.getElementsByTagName("title");
    برای (i = 0; i < x.length; i++) {
        txt += "Local name: " + x.item(i).attributes[0].localName + "<br>";
    }
    document.getElementById("demo").innerHTML = txt;
}

خود کا تجربہ کریں