iframe自适应子页高度

来源:互联网 发布:amazfit华米手表 知乎 编辑:程序博客网 时间:2024/05/17 08:47
<iframe name="iframepage" onload="iFrameHeight(this)"  class="flightTicket" frameborder="0" marginwidth="0" scrolling="auto" src="@url"></iframe>

function iFrameHeight(obj) {//var ifm = document.getElementById("iframepage");var ifm = objvar subWeb = document.frames ? document.frames["iframepage"].document : ifm.contentDocument;if (ifm != null && subWeb != null) {ifm.height = subWeb.body.scrollHeight;}}

0 0
原创粉丝点击