首頁  >  問答  >  主體

关于页面完全显示在div下的一个iframe中

<div class="main">
            <iframe name="homepage" 
id="iframepage" frameborder="0" scrolling="auto" marginheight="0" 
marginwidth="0" onLoad="iFrameHeight()" width=100% height="100%">
            </iframe>
 这是我div中的iframe,
function iFrameHeight() {
var ifm= document.getElementById("iframepage");
var subWeb = document.frames ? document.frames["iframepage"].document : ifm.contentDocument;
if(ifm != null && subWeb != null) {
   ifm.height = subWeb.body.scrollHeight;
   ifm.width = subWeb.body.scrollWidth;
}
}

  这是我定义的function
.main{width:100%;height:100%;background:#f6f6f6;overflow:auto;}
这是div class="main"的CSS部分 但是实际效果 我要显示的页面并没有完全显示在iframe中,网上找了很多方法对我这种情况都没有效果 求教如何解决

大家讲道理大家讲道理2898 天前838

全部回覆(1)我來回復

  • 代言

    代言2016-11-11 11:55:30

    你要实现什么效果,我看你的内容是在iframe的矩形框里

    回覆
    0
  • 取消回覆