IFrame 콘텐츠 창 속성
예시
iframe에 포함된 문서의 배경색을 변경하는 방법에 대한 크로스 브라우저 예:
var x = document.getElementById("myframe");
var y = (x.contentWindow || x.contentDocument);
if (y.document)y = y.document;
y.body.style.backgroundColor = "red";
정의 및 사용
contentWindow 속성은 iframe 요소에 의해 생성된 Window 개체를 반환합니다(window 개체를 통해 문서 개체에 액세스한 다음 문서의 요소 중 하나에 액세스할 수 있음).
브라우저 지원
Property | |||||
---|---|---|---|---|---|
contentWindow | Yes | Yes | Yes | Yes | Yes |
통사론
iframeObject.contentWindow
기술적 세부 사항
반환 값: | 윈도우 객체에 대한 참조 |
---|
더 많은 예
예시
iframe의 문서에 액세스하여 배경색을 변경하는 방법의 또 다른 예:
var x = document.getElementById("myframe");
var y = x.contentWindow.document;
y.body.style.backgroundColor = "red";
❮ IFrame 객체