在<iframe>元素中加入如下onload即可
onload=' this.style.height=Math.max(this.contentWindow.document.body.scrollHeight,this.contentWindow.document.documentElement.scrollHeight,200)+"px";'
本文介绍了一种通过在iframe元素中使用onload事件来自动调整其高度的方法,确保iframe的内容能够完全展示而不会出现滚动条。
在<iframe>元素中加入如下onload即可
onload=' this.style.height=Math.max(this.contentWindow.document.body.scrollHeight,this.contentWindow.document.documentElement.scrollHeight,200)+"px";'
853
919

被折叠的 条评论
为什么被折叠?