我在网上找了很多相关的解决方案,并且也试过了。但为什么都不起作用呢。
高度一直是默认的160,我没有设定他的高度啊
<script type="text/javascript"> 
        function SetCwinHeight() 
        { 
            try{ 
                var bobo=document.getElementById("ifram123"); //iframe id 
                if (document.getElementById) 
                { 
                    if (bobo && !window.opera) 
                    { 
                        if (bobo.contentDocument && bobo.contentDocument.documentElement.offsetHeight) 
                        { 
                            bobo.height = bobo.contentDocument.documentElement.offsetHeight+30; 
                        } 
                        else if(bobo.Document && bobo.Document.body.scrollHeight) 
                        { 
                            bobo.height = bobo.Document.body.scrollHeight+300;//40是空白,可根据需要自己改 
                        } 
                    } 
                } 
            }catch(err) 
            {} 
        } 
        </script> <iframe id="ifram123" name="myframe" scrolling="auto"  onload="SetCwinHeight()" width="100%"  style="border:0px; " frameborder="0" src="http://www.67dajie.com"> 求解

解决方案 »

  1.   

    怎么没人理我啊。以下是从懒人图库下载下来的,可是还是不行
    <iframe name="lanrentuku" src="http://www.lanrentuku.com/" frameborder=false scrolling="auto" width="100%" height="100%" frameborder=no onload="document.all['lanrentuku'].style.height=lanrentuku.document.body.scrollHeight+100" ></iframe>
      

  2.   

    看看这样行不行<script type="text/javascript">
              $(document).ready(function () { 
                    //设置iframe 高,宽
                  $('#ifram123').css({ 
                           height: $(document).height() + 'px', 
                           width: $(document).width()+ 'px' 
                 }); 
              });
      </script>
      

  3.   

    跨域了吧,跨域的话读不到iframe内部高度的
      

  4.   

    嗯,iframe里调用外部网站的东西,这时的iframe内部元素是不可读的看你具体需求了,太复杂的应该做不到。如果只是想加一个顶部的导航条啥的,还是有办法的。
      

  5.   

    据说跨域,有用ajax来弄的。
    呵呵。