2
Javascript의 문서 개체에서 창 개체에 직접 액세스 할 수 있습니까? 예를 들어문서 개체에서 window 개체에 액세스하는 방법
:
// window.frames[0] returns the document object of the first frame or iframe found on the page
myFunc(window.frames[0]);
function myFunc(doc) {
// I want to do something along these lines:
var wnd = doc.getWindow();
alert("Found frame: " + wnd.name);
for (var i=0; i<wnd.frames.length; i++) {
myFunc(wnd.frames[i]);
}
}
나는 이것에 대한 jQuery를 사용할 수 없습니다, 죄송합니다.
의 매우 초기 버전에서 지원되지 않습니다 생각합니다. 'contentWindow'로 질문에 제시 한 예제 코드를 보면 브라우저가 작동하지 않는다는 것을 알 수 있습니다. –
@NickBrunt MDN 문서에 따르면'windows.frames [0]'의 결과는 'contentWindow'여야합니다. 'window.frames [0]'과'document.getElementsByTagName ("iframe") 사이에는 차이가 있습니다. [0]' – JaredPar
일어날 일과해야할 일 사이에는 큰 차이가 있습니다. 직접 해보십시오. –