注册 登录
编程论坛 ASP技术论坛

js如何调整 iframe 高度自动适应

kira007 发布于 2008-09-01 01:05, 1043 次点击
如题  在index.html 页面有

<iframe src="help.asp" name="contor" id="contor" scrolling="no" frameborder="0" width="100%" onload="autoResize();"  align="middle"></iframe>

iframe 内的 help.asp 页面因数据变化而产生高度变化时 ,能否用JS 自动调整 这个 iframe 的高度
2 回复
#2
hmhz2008-09-01 02:29
程序代码:

<script>
function autoResize(){
try {document.all["contor"].style.height=contor.document.body.scrollHeight}
catch(e){return false;}
}
</script>
<iframe src="help.asp" name="contor" id="contor" scrolling="no" frameborder="0" width="100%" style="height:expression(1); aho:expression(autoResize());" align="middle"></iframe>
#3
kira0072008-09-01 21:18
谢谢版主!问题解决了
版主好厉害啊
1