XML DOM ownerElement プロパティ
Attr オブジェクト
定義と用法
ownerElement プロパティは、属性が付属している要素ノードを返します。
構文
例
次のコードは、loadXMLDoc() を使用して xmlDoc に
"books.xml" をロードし、
最初の category 属性が付属している要素ノードを返します:
例
xmlDoc=loadXMLDoc("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);
|
上記コードの出力は次の通りです:
試してください »
|
Attr オブジェクト
|