只能实现按取消转去另个页面,我认为。   window.onbeforeunload = function(e){
location.href="http://www.baidu.com"       
e = e || window.event;
e.returnValue = "really go?";   } 

解决方案 »

  1.   

      window.onbeforeunload = function(e){
             
        e = e || window.event;
        e.returnValue = "really go?";
    location.href="http://www.baidu.com"  
       } 
      

  2.   

    ajax把另一个页面的内容弄过来,想要不刷新让地址栏的地址变掉恐怕不可能吧。
      

  3.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    </head>
    <script>
    function hhh(e){
    e = e || event;
    if(e.keyCode == 116){
    e.keyCode = 13;
    if(confirm("转向www.baidu.com?")){
    window.location.href = "http://www.baidu.com";
    };
    return false;
    }
    }
    document.onkeydown = hhh;
    </script>
    <body>
    <input type="text" />
    </body>
    </html>
      

  4.   

    <script>
    window.onbeforeunload = function(){
           if(confirm("确定退出??")){
            window.open("http://www.sina.com.cn");
            }
           
       } </script>
      

  5.   

    if(confirm("确定退出??")){ 
          window.open("http://www.sina.com.cn"); 
      

  6.   

    [Quote=引用 12 楼 mengxj85 的回复:]
    引用 3 楼 chinmo 的回复:
      window.onbeforeunload = function(e){ 
            
        e = e || window.event; 
        e.returnValue = "really go?"; 
    location.href="http://www.baidu.com"  
      }