方案一: <iframe src=”http://www.alixixi.com/index.htm” name=”content” id=”content” allowtransparency=”true” align=”default” marginwidth=0 marginheight=0 frameborder=0 scrolling=no height=”200″ width=”500″ onload=”this.height=0;var fdh=(this.Document?this.Document.body.scrollHeight:this.contentDocument.body.offsetHeight);this.height=(fdh>200?fdh:200)//code by Tencent.nokersang”>This message is only visible to older browsers.</iframe> 方案二: <script language=javascript> function iframeAutoFit() { try { if(window!=parent) { var a = parent.document.getElementsByTagName(”IFRAME”); for(var i=0; i<a.length; i++) //author:meizz { if(a[i].contentWindow==window) { var h = document.body.scrollHeight; if(document.all) {h += 4;} if(window.opera) {h += 1;} a[i].style.height = h; } } } } catch (ex) { alert(”腳本無(wú)法跨域操作!”); } } if(document.attachEvent) window.attachEvent(”onload”, iframeAutoFit); else window.addEventListener(’load’, iframeAutoFit, false); </script>