try:
<script>
function window.onbeforeunload()
{
  if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey)
  {
   var a=window.open()
   if(!confirm('要走了吗?'))a.location.href=location.href
   else a.location.href='2.php'
  }
}
</script>   
<body>
helo
</body>

解决方案 »

  1.   

    <script>
    function window.onbeforeunload()
    {
      if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey)
      {
       var a=window.open()
       if(!confirm('要走了吗?'))a.location.href=location.href
       else a.location.href='2.htm'
      }
    }
    </script>   
    <body>
    helo
    </body>
      

  2.   

    只看懂前面一句话。
    <body onbeforeUnload="return '确定退出吗?';">
    </body>