javascript网页关闭时提醒效果脚本

  

复制代码 代码如下:

  <script language=javascript>

  function stoprefresh()

  {

  return "you will lose any unsaved content";

  }

  function UnloadConfirm()

  { //页面离开后的事件

  alert('离开页面后的一些清理工作……');

  }

  </script>

  <body>

  <script>

  window.onbeforeunload=stoprefresh; //注册关闭前的事件

  window.onunload = UnloadConfirm; //注册关闭后的事件

  </script>

  <a href = "http://www.glzy8.com">管理资源吧</a>

  </body>