就是打开网页弹出一个对话框,有“确定” “取消” 点点击确定就 新窗口打开一个设定的页面 点击取消 就留在当前页面 

解决方案 »

  1.   

    <script>
    window.onload = test;function test(){
    if(confirm("打开新浪网站?")){
    open("http://www.sina.com.cn");
    }
    }
    </script>
      

  2.   


     <!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=utf-8" />
    <title>提示框</title>
    <STYLE>  
    #out{
    width:240px;
    height:100px;
    position:absolute;
    border:1px solid #999; 
    z-index:10000;
    background:#CCC;
    display:none;
    }
    #yes{
    margin-left:60px;
    margin-top:1px;
    }
    #no{
    margin-left:10px;
    }
    </STYLE>   
    <script src="jquery-1.3.2.js"></script>
    <script>
    $(document).ready(function(){
        $("#test").click(function(){
            $("#out").show();
    });
    $("#yes").click(function(){
        open("http://www.g.cn");
    });
    $("#no").click(function(){
        $("#out").hide();
    return;
    });
    });
    </script>
    </head>
    <body>
    <input type="button" id="test" value="点一下" /><br />
    <div id="out">
        <center><h3>弹出提示</h3></center>
        <input type="button" id="yes" value="确定" />
        <input type="button" id="no" value="取消" />
    </div>
    </body>
    </html>这是全部完整的代码,在ff中运行就可以看到,不过我用的是jquery库
      

  3.   

    <script>
    window.onload = test;function test(){
    if(confirm("打开新浪网站?")){
    window.href.location="http://www.sina.com.cn";
    }
    }
    </script>
      

  4.   

    <script type="text/javascript">
    window.onload = test;
    function openWin(){
      if(confirm("new window?")){
       window.href.location="http://www.baidu.com";
      }
    }
    </script><body>
    <input type="button" value="newwindow" onclick="openWin()"/>
    </body>
      

  5.   


    <script>
    window.onload = test;function test(){
    if(confirm("打开百度网站?")){
    open("http://www.baidu.com");
    }
    }
    </script>