2011-03-23 2 views

답변

1
$('#AssessmentsIFrame').contents().find('#wpv_1266351'); 
+0

어떻게 null로 테스트 할 수 있습니까? –

+1

var t = $ ('# AssessmentsIFrame'). 내용(). 찾기 ('# wpv_1266351'). 길이 || 없는; – Matijs

+0

다음과 같이 시도해 보았습니다. if ($ ('AssessmentsIFrame'). contents(). find ('# titlediv_1266231'). 길이 == null) {alert ('a'); setTimeout ('DisplayUploadButtons()', 1000); 반환; } 버튼이 없어도 알림이 표시되지 않았습니다. –

0

먼저, iframe이 같은 도메인 이름이어야한다, 그렇지 않으면 당신은 아무것도 얻을 수 없습니다.

var ifr = $('#'), 
ifrDoc = ifr.contentDocument || (ifr.contentWindow && ifr.contentWindow.document) || ifr.document, 
button = ifrDoc.getElementById('wpv_1266351'); 

버튼은 null이거나 버튼에 대한 참조입니다. jQuery는 iframe 문서 참조 자체를 가져 오는 방법을 모르기 때문에 jQuery를 사용하면 더 간단하지 않습니다.

관련 문제