好困惑!!

来源:2-7 编程练习

啊西巴

2015-10-30 19:36

为什么设置了默认网址之后,再弹出来的对话框中我换个网址点确定还是进的默认网址

写回答 关注

2回答

  • 风鹤子
    2015-11-01 17:21:55

    window.open();最后多了个单引号

  • Junx_
    2015-10-31 15:23:48
    <!DOCTYPE html>
    <html>
     <head>
      <title> new document </title>  
      <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>   
      <script type="text/javascript">  
        function openWindow(){
        var a = confirm("是否打开新窗口?");
        if(a){
            var b = prompt("输入要打开的网址","www.imooc.com");
            if(b!=null){
            window.open('http://'+b,'_blank','width=400px,height=500px,menubar=no,toolbar=no'');
            }
        }
            
    }
      </script> 
     </head> 
     <body> 
    	  <input type="button" value="新窗口打开网站" onclick="openWindow()" /> 
     </body>
    </html>


JavaScript入门篇

JavaScript做为一名Web工程师的必备技术,本教程让您快速入门

742076 学习 · 9869 问题

查看课程

相似问题