<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><script><BR> function closeIt()<BR> {<BR> return "Any string value here forces a dialog box to \n" + <BR> "appear before closing the window.";<BR> }<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><br><br><br> </div> <br>兼容FF,IE,Chrome的js离开或刷新页面检测,<font style="COLOR: #ff0000">关键的部分是要有return</font>