는 동적으로 iframe을 크기를 조정하는 몇 가지 코드가 있습니다IE에서 동적 IFrame 크기가 작동하지 않습니까?
function autoResizeFrames() {
frames = document.getElementsByTagName("iFrame");
window.setInterval("autoresize_frames()", 400);
}
function autoresize_frames() {
for (var i = 0; i < frames.length; ++i) {
if (frames[i].contentWindow.document.body) {
var frames_size = frames[i].contentWindow.document.body.offsetHeight;
if (document.all && !window.opera) {
frames_size = frames[i].contentWindow.document.body.scrollHeight;
}
frames[i].style.height = frames_size + 'px';
}
}
}
이 기능은 파이어 폭스와 크롬에서 잘 작동을하지만, IE 10과 9는 모 효과가 있습니다. 여기
은 내가 IFrame을을 가지고있는 곳입니다
<div id="projectModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="projectModalLabel"
aria-hidden="true">
<div class="modal-header">
<button type="button" runat="server" onserverclick="btnClose_Click" class="close" aria-hidden="true">
×</button>
<h3 id="projectModalLabel">Edit Project</h3>
</div>
<div class="modal-body">
<iframe src="" style="width: 100%; height: 200px; border: none;" frameborder="0" id="projectFrame" name="projectFrame" scrolling="no" allowtransparency="true"></iframe>
</div>
<div class="modal-footer">
<button type="button" runat="server" onserverclick="btnClose_Click" class="btn" aria-hidden="true">
Close</button>
</div>
</div>
왜 IE를 제외한 모든 곳에서 작동합니까? 자바 스크립트가 어디에서나 작동한다고 생각 했나요?
감사
그것은 말한다 :
SCRIPT5007: Unable to get property 'document' of undefined or null reference
kezcommon.js, line 62 character 5
if (frames.contentWindow.document.body) {
IE가하는 일종의 XSS 예방일까요? –
jsfiddle을 제공해 주시겠습니까? 또한 : 자바 스크립트 오류를 보았습니까? –
IE의 로그에서 오류를 게시했습니다 ... – user2043533