【发布时间】:2015-07-19 06:57:36
【问题描述】:
当我按下 iframe 中的按钮时,它会消失标签,但不会调整 iframe 的大小。 ajax 完成后应该在另一个页面调用 AjustResizeIframeHeight 方法 有什么建议吗?
更新
带有 iframe 的页面
<script language="javascript" type="text/javascript">
function resizeIframe(obj) {
obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
}
function AdjustIframeHeight(i) { document.getElementById("form-iframe").style.height = parseInt(i) + "px"; }
</script>
<iframe id"form-iframe" width="100%" style="border: none" src="{{ notes }}" onload='javascript:resizeIframe(this);'>
</iframe>
内容 iframe:
<a href="#" onclick="xpto2(1,{{ n.id }});parentNode.parentNode.removeChild(parentNode)" >Don't show again</a>
<script>
function xpto2(status,noteid) {
var request = $.ajax({
....
});
request.done(function() {
window.parent.AdjustIframeHeight();
});
}
</script>
在 ajax 函数中添加了window.parent.AdjustIframeHeight(),但它显示“未解析的函数或方法”
【问题讨论】:
标签: javascript jquery html ajax iframe