lookupPrefix()
XML DOM lookupPrefix() metodi
❮ Element obyekti
Misol
Quyidagi kod fragmenti "books_ns.xml" faylini xmlDoc’ga yuklaydi va berilgan nomlar fazosi URI’si uchun prefiksni topadi:
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 xmlDoc = xml.responseXML;
var x = xmlDoc.getElementsByTagName("book")[0];
document.getElementById("demo").innerHTML =
x.lookupPrefix("https://www.w3schools.com/children/");
}
Natija:
c
O‘zingiz sinab ko‘ring »
Ta’rif va qo‘llanilishi
lookupPrefix() metodi joriy tugunda ko‘rsatilgan nomlar fazosi URI’siga mos keladigan prefiksni qaytaradi.
Sintaksis
elementNode.lookupPrefix(URI)| Parametr | Tavsif |
|---|---|
| URI | Majburiy. Prefiksi topiladigan nomlar fazosi URI’si |
❮ Element obyekti
W3Schools Pathfinder
Yutuqlaringizni kuzating – bu bepul!
