日期:2014-05-16  浏览次数:20360 次

求iframe自动调高的方法(iframe中套的是frameset)
-- main.jsp ------------------------
<iframe name="sub" src="sub.jsp" height="400" frameborder="0" scrolling="no"  
  onload="this.style.pixelHeight=sub.document.documentElement.scrollHeight;">
</iframe>

-- sub.jsp ------------------------
<frameset cols="150,*" border="1">
  <frame name="staff_left" src="staff_left.jsp">
  <frame name="staff_right" src="staff_right.jsp">
</frameset>

==============================================================================
因我在iframe中套的是frameset,
用onload="this.style.pixelHeight=sub.document.body.scrollHeight;"
和onload="this.style.pixelHeight=sub.document.documentElement.scrollHeight;"
都无法实现iframe自动调高。


求iframe自动调高的方法!



------解决方案--------------------
iframe里套frameset。。。。。why...
------解决方案--------------------
在staff_left的body onload方法中计算staff_left页面的高度和staff_right 的高度 相加 然后改变sub 的高度

------解决方案--------------------
思路:

<div id=div1 style="width:100%;height:100px;">
<iframe width="100%" height="100%" ... >
</iframe>
</div>

利用更改div的宽高改变iframe宽高