HTMLIFrameElement.contentWindow

contentWindow プロパティは、 HTMLIFrameElement が所属する Window オブジェクトを返します。この Window オブジェクトを使用して、 iframe の文書や内部 DOM にアクセスすることができます。この属性は読み取り専用ですが、グローバルの Window オブジェクトのように操作することができます。

Window オブジェクト。

var x = document.getElementsByTagName("iframe")[0].contentWindow;
//x = window.frames[0];

x.document.getElementsByTagName("body")[0].style.backgroundColor = "blue";
// 文書内の 1 番目の iframe が青くなります。

仕様書

Specification
HTML Standard
# dom-iframe-contentwindow

ブラウザーの互換性

BCD tables only load in the browser