XML DOM documentURI Property
❮ วัตถุเอกสาร
ตัวอย่าง
โค้ดย่อยต่อไปนี้โหลด " books.xml " ลงใน xmlDoc และแสดงตำแหน่งของเอกสาร XML:
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 xmlDoc = xml.responseXML;
document.getElementById("demo").innerHTML
=
"Document location: " + xmlDoc.documentURI;
}
เอาท์พุท:
Document location: https://www.w3schools.com/xml/books.xml
ความหมายและการใช้งาน
คุณสมบัติ documentURI ตั้งค่าหรือส่งคืนตำแหน่งของเอกสาร
ไวยากรณ์
documentObject.documentURI
❮ วัตถุเอกสาร