我们的网站想套 搜狐 和中华网的新闻页 用ifame 怎么自适应高度 把他们的页面全部显示出来

解决方案 »

  1.   

    <iframe id="iFrame1" name="iFrame1" width="100%" onload="this.height=iFrame1.document.body.scrollHeight" frameborder="0" src="index.htm"></iframe>关键就在于onload="this.height=iFrame1.document.body.scrollHeight"试试
      

  2.   

    document.frames[iFrameid].document.body.scrollHeight ;   
    其他
     document.frames[iFrameid].document.body.clientHeight;
      

  3.   

    给你个思路:用一个循环,每次判断iframe是否有滚动条,如果没有就将iframe的height加上20px。
      

  4.   

    给楼主个兼容所有浏览器的 <script type="text/javascript"> 
        function setHeight(target)
    {
    target.height=(window.ActiveXObject?target.Document.body.scrollHeight:target.contentDocument.body.offsetHeight);
    }
        </script> <iframe src="Default.aspx" onload="setHeight(this)" scrolling="no" frameborder="0"></iframe> 
      

  5.   

    http://www.google.com.hk/search?hl=zh-CN&source=hp&q=iframe+%E8%87%AA%E9%80%82%E5%BA%94%E9%AB%98%E5%BA%A6&aq=f&aqi=&aql=&oq=&gs_rfai=