XML DOM ownerDocumentプロパティ


Node 对象参考手册Node オブジェクト

定義と使い方

ownerDocument プロパティは、ノードのルート要素(document オブジェクト)を返します。

構文

nodeObject.ownerDocument


例

次のコードスニペットは、loadXMLDoc()を使用して "" を xmlDoc に読み込み、最初の <title> ノードのルート要素を返します:

例

xmlDoc=loadXMLDoc("books.xml");

x=xmlDoc.getElementsByTagName("title")[0].ownerDocument;

document.write("Nodename: " + x.nodeName);
document.write(" (nodetype: " + x.nodeType + ")");

上記のコードは次のように出力します:

Nodename: #document (nodetype: 9)

試してみる »

Node 对象参考手册Node オブジェクト その他の拡張