attribute ownerElement ของ XML DOM

การนิยามและการใช้งาน

attribute ขององค์ประกอบ ownerElement คืนองค์ประกอบของ attribute

การใช้งาน

attrObject.ownerElement

ตัวอย่าง

ในทุกตัวอย่าง พวกเราจะใช้แบบแบ่งปัน XML books.xmlและฟังก์ชัน JavaScript loadXMLDoc()

โค้ดบริบทดังนี้จะคืนค่าขององค์ประกอบที่มีคุณสมบัติ category แรก

xmlDoc=loadXMLDoc("/example/xdom/books.xml");
x=xmlDoc.getElementsByTagName('book');
document.write(x.item(0).attributes[0].ownerElement);
document.write("<br />");
document.write(x.item(0).attributes[0].ownerElement.nodeName);
document.write("<br />");
document.write(x.item(0).attributes[0].ownerElement.nodeType);

การแสดงผลของโค้ดดังกล่าวคือ:

[object Element]
book
1