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>