<script>
if(confirm("go to a.htm?"))
window.location.href="a.htm";
else
window.location.href="b.htm";
</script>

解决方案 »

  1.   

    当然可以,这样写<html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>无标题文档</title>
    </head><body>
    <script language="JavaScript" type="text/JavaScript">
    if(confirm('choose?'))window.open('b.htm');
    else
    window.open('a.htm');
    window.close();
    </script></body>
    </html>
      

  2.   

    if(confirm("跳转到a页面吗?")){
      window.location.href='a.html';
    }
    else{
     window.location.href='a.html';
    }
      

  3.   

    我想我表达错了意思,我要的是:如果选择是,这继续这个页面,如果否就到回退到前一个页面!
    是不是这样:
    <script language="JavaScript" type="text/JavaScript">
    if(!confirm("跳转到a页面吗?")){
      window.location.history.back(1);
    }小弟没有学过js,见凉!多谢!
      

  4.   

    这样:
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>无标题文档</title>
    </head><body>
    <script language="JavaScript" type="text/JavaScript">
    if(confirm('choose?'))window.location.href='a.html';
    else
    history.back();
    </script></body>
    </html>
      

  5.   

    <script>
    if(!confirm("continue this page?"))
    window.history.go(-1);
    </script>
      

  6.   

    但是为什么我在这个页面里面的asp代码会在这段js之前执行???
    实在我的asp代码是写在<body>里面的呀???to :hxy75(小潜)
    我是用一个链接到这个页面的,又不是form,也可以询问吗?谢谢!
      

  7.   

    我这样写也不行,总是线跳转到c.htm:
    <script language="JavaScript" type="text/JavaScript">
    if(confirm("确实吗?")){
    <%
      Response.Redirect("c.htm");
    %>
    }
    else
      history.back(1);
    </script>