高度自适应可以用Javascript
你每个iframe为一个单独的页面,只需在每个单独的页面中head与/head之间加入如下代码即可实现firame高度的自适应:
script type=text/javascript
function setWindowSize(){ //iframe自动本窗口高度
try{
var thiswin = window.parent.document.getElementById(window.name);
if(window.document.body.scrollWidth-thiswin.offsetWidth6){
document.body.style.overflowX=auto;
thiswin.height=window.document.body.scrollHeight+20;
thiswin.width=window.document.body.scrollWidth+20;
}else{
document.body.style.overflowX=hidden;
thiswin.height=window.document.body.scrollHeight;
thiswin.width=window.document.body.scrollWidth
}
}catch(e){ }
}
/script
body onLoad=setWindowSize()
取消
评论