iframe切换内容页仍然能自适应大小代码(含js)
2016-08-02 16:58
351 查看
function setIframeHeight(iframe) { if (iframe) { var iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow; if (iframeWin.document.body) { iframe.height = iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.scrollHeight; } } }; window.onload = function () { setIframeHeight(document.getElementById('myiframe'));//iframe的id
}; <iframe onload="setIframeHeight(this)" id="myiframe" name="item-ifram" class="ZhaoShangJiaMeng-ifram" src="ZhaoShangJiaMeng-QuanYi.html" frameborder="0" scrolling="no" ></iframe>
相关文章推荐
- 如何使IFrame的长宽与内容自动适应大小
- 如何使IFrame的长宽与内容自动适应大小
- 如何使IFrame的长宽与内容自动适应大小
- table+div+iframe打造高度自适应的后台布局框架(需要用JS控制大小)
- js跨域问题之跨域iframe自适应大小实现代码
- 如何使IFrame的长宽与内容自动适应大小
- 如何使IFrame的长宽与内容自动适应大小
- 如何使IFrame的长宽与内容自动适应大小
- 如何使IFrame的长宽与内容自动适应大小
- 用js自适应iframe的大小
- 如何使IFrame的长宽与内容自动适应大小
- 如何使IFrame的长宽与内容自动适应大小
- 如何使IFrame的长宽与内容自动适应大小
- iframe的大小自动适应嵌入页面大小的代码
- 如何使IFrame的长宽与内容自动适应大小
- 如何使IFrame的长宽与内容自动适应大小
- 如何使IFrame的长宽与内容自动适应大小
- 如何使IFrame的长宽与内容自动适应大小
- JS怎么控制IFRAME高度自动适应内容而不出现滚动条
- js代码:实现主页面滚动条随iframe里的内容自动调整