为什么点击按钮没反应呢?求大神指导

来源:2-7 编程练习

chx_1998

2018-06-19 11:24

<!DOCTYPE html>

<html>

 <head>

  <title> new document </title>  

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>   

  <script type="text/javascript">  

    

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

    var URL = "http://www.imooc.com/"

    function openWinow(){

    var aa = confirm("是否要跳转到其他页面")

    if(aa==true){

        prompt("请输入需要打开的网址",URL);

        window.open(

           'URL' '_blank','height=500,width=400,menubar=no,toolbar=no')

    }

}

    

    

    

    

  </script> 

 </head> 

 <body> 

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

 </body>

</html>


写回答 关注

2回答

  • BlueRise
    2018-06-20 10:22:00

    <!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 abs=confirm("是否打开窗口");
    if(abs)
        window.open(' http://www.imooc.com/','_blank','width=400px,top=500px,left=0,menubar=no,toolbar=no')

        //打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。
       }
        
      </script>
     </head>
     <body>
          <input type="button" value="新窗口打开网站" onclick="openWindow()" />
     </body>
    </html>

  • qq_小心你背后的那只手_0
    2018-06-19 13:04:39

    <!DOCTYPE html>
    <html>
     <head>
      <title> new document </title>  
      <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>   
      <script type="text/javascript">  
       
        // 新窗口打开时弹出确认框,是否打开
     var URL = "http://www.imooc.com/"

        function openWindow(){
        var aa = confirm("是否要跳转到其他页面")
        if(aa==true){
            prompt("请输入需要打开的网址",URL);
            window.open(
              URL ,'_blank','height=500,width=400,menubar=no,toolbar=no')

        }



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

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

        //打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。
        
        
      </script>
     </head>
     <body>
          <input type="button" value="新窗口打开网站" onclick="openWindow()" />
     </body>
    </html>

    chx_19... 回复qq_小心你...

    好的谢谢

    2018-06-23 13:38:13

    共 2 条回复 >

JavaScript入门篇

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

738661 学习 · 9561 问题

查看课程

相似问题