<script language=javascript>
window.onbeforeunload = function()
{
  if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey)
  {
    window.event.returnValue = "";
  }
}
</script>

解决方案 »

  1.   

    框架网页的关闭事件捕捉
    <html>
      <head>
      <title>框架网页的关闭事件捕捉</title>
        <script language="javascript">
        /*@cc_on @*/
        /*@if (@_win32 && @_jscript_version>=5)
        function window.onbeforeunload()  //author: meizz
        {
          var b = event.clientX>window.frameTop.document.body.clientWidth-20;
          //注意 window.frameTop 里的 frameTop 与框架里的横向框架页 name 对应
          if(b && window.event.clientY < 0 || window.event.altKey)
          {
            window.event.returnValue = ""; //这里可以放置你想做的操作代码
          }
        }
        @end @*/
        </script>
      </head>
    <frameset rows="100, *">
      <frame name=frameTop>
      <frameset cols="160, *">
        <frame name=frameLeft>
        <frame name=frameRight>
      </frameset>
      <noframes>
        <body>
          <h2 align="center">对不起!你的浏览器不支持框架网页</h2>
        </body>
      </noframes>
    </frameset>
    </html>