为什么不弹出窗口呢?

来源:2-7 编程练习

欧东东也有个梦想

2015-07-15 23:16

<!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=comfirm("是否打开网址?");

        if (A==true)

        {

            str=prompt("你要打开的网址为:","http://www.imocc.com");

            if (str!=NUll){

            window.open(str,'_blank','width=400,height=500,top=0,left=0,toolbar=0,menubar=no,scrollbars=no,status=no);}

            else alert("88");

        }

        else alert("88");

    };

    // 新窗口打开时弹出确认框,是否打开


    // 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/


    //打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。

    

    

  </script> 

 </head> 

 <body> 

 <input type="button" value="新窗口打开网站" onclick="openWindow()" /> 

 </body>

</html>


写回答 关注

1回答

  • arlenhui
    2015-07-16 00:00:18
    <!DOCTYPE html>
    <html>
     <head>
      <title> new document </title>  
      <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>   
    
     </head> 
     <body> 
    	  <input type="button" value="新窗口打开网站" onclick="openWindow()" /> 
            <script type="text/javascript">  
        function openWindow()
        {
            var A=confirm("是否打开网址?");
            if (A==true)
            {
                str=prompt("你要打开的网址为:","http://www.imocc.com");
                if (str!=null){
                window.open(str,'_blank','width=400,height=500,top=0,left=0,toolbar=0,menubar=no,scrollbars=no,status=no');
                }
                else alert("88");
            }
            else alert("88");
        }
        // 新窗口打开时弹出确认框,是否打开
    
        // 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/
    
        //打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。
        
        
      </script> 
     </body>
    </html>
    1. confirm拼写错误

    2. window.open 引号不完整

    3. js对大小写很敏感,NULL是错误的

    欧东东也有个...

    嗯嗯,谢啦。还是不够细心

    2015-07-19 23:14:57

    共 1 条回复 >

JavaScript入门篇

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

738245 学习 · 9560 问题

查看课程

相似问题