HTML DOM Element ownerDocument 屬性

定義和用法

ownerDocument 屬性返回節點的所有者文檔,以 Document 對象。

在 HTML 中,HTML 文檔本身始終是元素的 ownerDocument。

請在我們的 Document 對象參考手冊 中閱讀有關 Document 對象的更多信息。

實例

獲取 <p> 元素的所有者文檔的節點類型:

var x = document.getElementById("myP").ownerDocument.nodeType;

親自試一試

語法

node.ownerDocument

技術細節

返回值: 以 Document 對象返回節點的所有者文檔。
DOM 版本: Core Level 2 Node Object

瀏覽器支持

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
支持 支持 支持 支持 支持