后台经常需要上传非固定的公告,在公告显示页,通过iframe显示手动页面
发现页面一多,不同的高度,很凡,想偷懒,找到如下方法来解决,记录一下
<script language="javascript" type="text/javascript">
function resizeIframe(obj){
obj.style.height = (obj.contentWindow.document.body.scrollHeight + 10)+"px" ;
}
function resizeIframeNormal(obj){
obj.style.height = "995px" ;
}
</script>
<iframe id="frame" name="frame" οnlοad="resizeIframe(this);" ></iframe>