<div class="codetitle"> <span><a style="CURSOR: pointer" data="34035" class="copybut" id="copybut34035" onclick="doCopy('code34035')"><u>複製程式碼</u></a></span> 代碼如下:</div> <div class="codebody" id="code34035"> <br><br><br><br><br><br><br><br><br><script><BR> function closeIt()<BR> {<BR> return "Any string value here forces a dialog box to n" <> }<BR> window.onbeforeunload = closeIt;<BR></script><br><br><br> <a href="http://www.jb51.net">Click here to navigate to <br> www.jb51.net</a> </div> <br><font style="COLOR: #ff0000"></font>使用FF,IE,Chrome的js離開或刷新頁面偵測,關鍵的部分是要有return