<iframe src="test.asp" name="main" id="main" allowtransparency="true" align="default" marginwidth=0 marginheight=0 frameborder=0 scrolling=no height="200" width="850" οnlοad="this.height=0;var fdh=(this.Document?this.Document.body.scrollHeight:this.contentDocument.body.offsetHeight);this.height=(fdh>200?fdh:200)">您当前使用的浏览器不支持IFRAME,请安装IE6.0以上版的浏览器。</iframe>
这里的test.asp必须和当前页面在同一域下,否则将提示JS权限不足。
这个代码的功能是完全自适应窗口高度。无论是在IFRAME中点击链接,或重置src的值可行。
被调用页面中无需加入任何代码。