我的360浏览器打开新网页地址总是

来源:2-7 编程练习

落叶萧萧online

2017-09-21 21:36

http://www.imooc.com/code/www.imooc.com

代码就是练习的啊。。哪里有问题呢?

写回答 关注

3回答

  • 一只胡思乱想的猪
    2017-09-21 22:42:28
    已采纳
    <!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 flag=confirm("是否打开网页");
        // 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/
        if(flag==true){
            var str = prompt("请输入要打开的网页","http://www.imooc.com/");
        
        //打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。
            window.open(str,'_blank','width=400px,height=500px,toolbar=no,menubar=no');
        }
        }
        
      </script> 
     </head> 
     <body> 
    	  <input type="button" value="新窗口打开网站" onclick="openWindow()" /> 
     </body>
    </html>

    网址有前缀http://

    落叶萧萧on...

    非常感谢!

    2017-09-22 13:40:57

    共 1 条回复 >

  • 慕前端8556576
    2017-09-21 22:00:00

    要遵守http协议吧

    落叶萧萧on...

    谢谢你

    2017-09-22 13:41:39

    共 1 条回复 >

  • 落叶萧萧online
    2017-09-21 21:39:26
    <!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 str;
        str=confirm("是否打开新的网站");
        // 新窗口打开时弹出确认框,是否打开
        if(str==true){
            var str1;
            str1=prompt("请输入您要打开的网址","www.imooc.com");
        }
        // 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/
        if(str==true){
            window.open(str1,'_blank','width=400,height=500,menubar=no,toolbar=no');
            
        }
        //打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。
      }
        
      </script> 
     </head> 
     <body> 
    	  <input type="button" value="新窗口打开网站" onclick="openWindow()" /> 
     </body>
    </html>


JavaScript入门篇

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

741024 学习 · 9681 问题

查看课程

相似问题