<div class="codetitle"> <span><a style="CURSOR: pointer" data="901" class="copybut" id="copybut901" onclick="doCopy('code901')"><u>複製程式碼</u></a></span> 程式碼如下:</div> <div class="codebody" id="code901"> <br> <br> <br><title>測試</title> <br><script language="javascript" type="text/javascript"> <br><br>function getStyle() { <br><br>if (window.top == window.self) { <br><br>document.getElementById("top").style.display = 'block'; <br> <br>} else { <br><br>document.getElementById("top").style.display = 'none'; <br><br><BR>} <br><br>} <BR><br>} <br><BR>} <BR><BR>} <BR><BR>} <BR><BR>} <BR><BR>} </script> </div> <br>} <br><br>} } } } } <form id="form1" runat="server"> <div id="top"> 在框架中不顯示,正常存取顯示</div> </form> 當目前頁面正常存取時顯示div top 當目前頁面在iframe中時頁面不顯示div top