현재 윈도우에 iframe을 작업하고 iframe내 요소에 접근하기 위해서는
document.getElementById('iframe_id').contentWindow.document.getElementById("element_id")
와 같이 contentWindow로 iframe의 윈도우를 지정해 주어야합니다
contentWindow
The contentWindow property returns the window object for the frame.
Syntax
frameWindow = frameElement.contentWindowParameters
frameWindow is an object reference to the window object for this frame.
Example
f = document.getElementById("frame"); f.contentWindow.location = "http://mozilla.org"; f.contentWindow.history.back();Notes
You can also get to the window object through a named frame. For example, a frame with the name="myFrame" can refer back to the window object as window.frames["myFrame"].
Specification
DOM Level 2 -- HTMLFrameElement
[출처] [Jscript/DOM] contentWindow|작성자 낭망백수
'js' 카테고리의 다른 글
javascript string 확장 (0) | 2009.07.29 |
---|---|
form 에 속한 element 중 배열 name을 가졌을 경우 자바스크립트 접근방법 (0) | 2009.06.19 |
insertRow(-1) insertCell(-1) (0) | 2009.03.12 |
javascript를 이용 html 태그를 제외한 텍스트만 가져오기 (0) | 2009.02.27 |
부분만 인쇄하기 (0) | 2009.02.27 |