关于框架不随内容自涨的问题。

发布时间:2024-05-19 15:16 发布:上海旅游网

问题描述:

我做一个文章显示页,框架中间插入文章来源位置,结果内容不能显示完整,框架不随内容自涨。请问如何解决?
高为400

问题解答:

是使用ifream吗?例如:
<iframe name="boxMain" width="100%" height="100%" frameborder="0" scrolling="NO" src="1.html"></iframe>
那么在1.html的最后添加脚本:
<script language=javacript>
if(document.body.scrollHeight>450){
parent.document.all.boxMain.height=document.body.scrollHeight;
}else
{parent.document.all.boxMain.height=450;}
</script>
其中,450是框架的最小高度,可根据需要修改。

热点新闻