如果是真的就跳转到另一个页面,如果是假的话就停留在本页面
------------------------------------------------------------
function goOtherpage(str) 

   if(confirm("你当前页还没有保存,建议保存"))
   {
   return false;
   }
   location.href="aa.html";
   return true;
}
---------------------------------------------------------
好像不行喔~!应该怎么做呀~!请各位指教指教..

解决方案 »

  1.   

    function goOtherpage(str) 

       if(confirm("你当前页还没有保存,建议保存"))
       {
       document.location.href="aa.html";
       }
    }
      

  2.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title> New Document </title>
    <meta name="Generator" content="EditPlus">
    <meta name="Author" content="">
    <meta name="Keywords" content="">
    <meta name="Description" content="">
    </head><body>
    <script language="JavaScript1.2">
    <!--
    function goOtherpage(str) 

       if(confirm("你当前页还没有保存,建议保存"))
       {
       return false;
       }
       else
       {
       location.href="http://www.google.com";
       return true;
       }
    }
    goOtherpage("ddd");
    //-->
    </script></body>
    </html>
      

  3.   

    function goOtherpage(str) 

       if(!confirm("你当前页还没有保存,建议保存"))
       {
          location.href="aa.html";
       }
    }