您的位置:首页 > 其它

iframe自适应大小

2016-04-26 21:23 369 查看
<pre name="code" class="javascript"><pre name="code" class="html"><iframe id="iframe1" name="iframe1" frameborder="0" width="100%" scrolling="no" onLoad="iFrameHeight()"></iframe>


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



                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: