<div class="side_left">
<iframe src="left.html" name="leftFrame" id="leftFrame" scrolling="No" width="170px" height="330px" frameborder="0"></iframe>
</div>
<div class="content">
<iframe src="right1.html" name="mainFrame" id="mainFrame" width="740px" frameborder="0" scrolling="no"></iframe>
</div>
典型的,左边菜单点击右边框架显示,先是链接明明指定了target,火狐下却在新窗口中打开。排查了很久,发现犯了个很低级错误没用</iframe>闭合。直接<iframe..../>。IE下没问题,FF不干了....
再就是右边框架随内容自动适应高度的问题。网上很多解决方案,如:
<iframe src="right1.html" name="mainFrame" id="mainFrame" width="740px" frameborder="0" scrolling="no"></iframe>
<script type="text/javascript">
function reinitIframe(){
var iframe = document.getElementById("mainFrame");
try{
var bHeight = iframe.contentWindow.document.body.scrollHeight;
var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
var height = Math.max(bHeight, dHeight);
iframe.height = height;
}catch (ex){}
}
window.setInterval("reinitIframe()", 200);
</script>
在火狐下,并不能收缩,需要刷新页面,下面方法解决问题:
<iframe id="mainFrame" name="mainFrame" width="100%" οnlοad="this.height=mainFrame.document.body.scrollHeight" frameborder="0" src="index.htm"></iframe>