<script>
function window.onbeforeunload()
{
if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey)
{
if(confirm("确定要退出本页吗?")); {
                     location = "";
                   } else {                     关闭窗口
现在的问题是点击"确定"之后,马上关闭窗口了!
}else
{
alert("你在刷新");
//return false;
}
}
</script>

解决方案 »

  1.   

    这个和unload的有什么区别~骗子~
      

  2.   

    二楼的
    您说的方法不行,我试过,点击确定后,根本不重定向到我需要的那个页面,而是直接关闭了窗口window.event.returnValue这个值好像是必须的,只有该值为否时,页面才不关闭,而直接定向到另外的一页!
      

  3.   

    <script>
    function window.onbeforeunload(){
    if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey){
    if(confirm("确定要退出本页吗?")){
             } else {
     event.returnValue = false
    }
    }else{
    alert("你在刷新");
    }
    }
    </script>
      

  4.   

    改一下警告方式:<script>
    function window.onbeforeunload(){
    if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey){
    return "强行退出将导致不良后果!"
    }
    }
    </script>