700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > 自动适应大小html框架 HTML的frame框架肿么自适应高度?

自动适应大小html框架 HTML的frame框架肿么自适应高度?

时间:2023-12-06 06:23:40

相关推荐

自动适应大小html框架 HTML的frame框架肿么自适应高度?

高度自适应可以用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()

取消

评论

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。