<strong>實作原理:</strong>載入index.htm時候,每隔1秒鐘自動呼叫腳本刷新框架頁面程式碼<br><strong>程式碼優點:</strong>只需要設定index.html框架頁面中的腳本,呼叫載入的子頁面中不需要設定任何程式碼。 〈🎜> html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <br> <br> <div class="codetitle"> <title>首頁</title> <span><meta http-equiv="Content-Type" content="text/ html; charset=utf-8"> <a style="CURSOR: pointer" data="50596" class="copybut" id="copybut50596" onclick="doCopy('code50596')"> <u> </u><div style="float: left; width: 740px; height:auto; border: 1px #808080 Solid; margin: 5px 0px 5px 10px;overflow: hide"> <iframe name="ifr_obj" id="ifr_obj" src="%E9%80%99%E8%A3%A1%E5%B5%8C%E5%A5%97%E5%85%B6%E5%AE%83%E9%A0%81%E9%9D%A2%E5%9C%B0%E5%9D%80%E6%88%96%E6%AA%94%E6%A1%88%E5%90%8D%E7%A8%B1" frameborder="0" width="100% " scrolling="no" title="框架頁"></iframe> </div> </a></span> </div> <div class="codebody" id="code50596"> <script language="javascript" type="text/javascript"> <BR>function initIframeHeight() { <BR>try { <BR>var iframe = document.getElementById("ifr_obj"); <BR>if (iframe != null) { <BR>if (ifM.Window. != null) { <BR>var bHeight = iframe.contentWindow.document.body.scrollHeight; <BR>var dHeight = iframe.contentWindow.document.documentElement.scrollHeight; <BR>var height = Math.max(bHeightentElement. ); <BR>iframe.height = height; <BR>} <BR>} <BR>} <BR>catch (ex) { <BR>alert("載入框架頁面高度時發生錯誤" ex.toString()) ; <BR>} <BR>} <BR>window.setInterval("initIframeHeight()", 1000); <BR></script> <br> <br><br> </div>