现在有这样的代码:
<table width="100%" border="1">
  <tr>
    <td><iframe height="100%" width="100%" src="home:blank"></iframe></td>
  </tr>
</table>或者:<div><iframe height="100%" width="100%" src="home:blank"></iframe></div>可以让iframe的高度随td 或 div 的高度而变吗?

解决方案 »

  1.   

    lz已经设置了。  只要再给<iframe>的父元素给定高度就行了。
      

  2.   


    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;
        }   
    }              <iframe width="100%" frameborder="0" id="iframepage" scrolling="no" name="iframepage"
                    onload="iFrameHeight()" src="defaultUrl.aspx"></iframe>
      

  3.   

    那lz就不要给<iframe>设置百分比,用像素设置就好了。用百分比设置高度,是要以父节点的高度作为参考的吧,父节点没设置就会一直往上找。