自适应高度框架 ----属个人收藏内容
自适应高度框架 ----属个人收藏内容
发布时间:2016-12-30 来源:查字典编辑
摘要:main.htm:iframe自适应加载的页面高度child.htm:iframe自适应其加载的网页(多浏览器兼容)iframe自适应其加载...

main.htm:

<html>

<head>

<metahttp-equiv='Content-Type'content='text/html;charset=gb2312'/>

<metaname='author'content='F.R.Huang(meizz梅花雪)//www.meizz.com'/>

<title>iframe自适应加载的页面高度</title>

</head>

<body>

<div><iframesrc="child.htm"></iframe></div>

</body>

</html>

child.htm:

<html>

<head>

<metahttp-equiv='Content-Type'content='text/html;charset=gb2312'/>

<metaname='author'content='F.R.Huang(meizz梅花雪)//www.meizz.com'/>

<title>iframe自适应其加载的网页(多浏览器兼容)</title>

<scripttype="text/javascript">

<>

</script>

</head>

<body>

<tableborder="1"width="200"style="height:400px;background-color:yellow">

<tr>

<td>iframe自适应其加载的网页(多浏览器兼容,支持XHTML)</td>

</tr>

</table>

</body>

</html>

======================================

iframe标签的高度怎么样才能自适应src的页面?

例如:<iframeid=box2name="cok"src="agree.htm"width="100%"scrolling="no"frameborder="0"marginwidth="0"marginheight="0"></iframe>

这个iframe的高度怎么能自适应agree.htm的高度600?

不要告诉我设为height=600,因为这个iframe要应用几个高度不同的页面!

谢谢,找到了

<script>

functionautoResize()

{

try

{

document.all["test"].style.height=test.document.body.scrollHeight

}

catch(e){}

}

</script>

<iframeid=teststyle="height:expression(1);aho:expression(autoResize())"src=""></iframe>

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新Javascript教程学习
热门Javascript教程学习
编程开发子分类