问答详情
源自:2-7 编程练习

2—7弹不出框啊

<!DOCTYPE html>

<html>

 <head>

  <title> new document </title>  

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

  <script type="text/javascript">  

       function gg(){

      var gg=confirm("新窗口打开时弹出确认框,是否打开");

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

    if (gg==true) {

        var g=prompt("请输入网址:","http://www.imooc.com");

    window.open("http://www.imooc.com,_blank,width=400,height=500,menubar=no,toolbar=no,") 

    };

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

    else

     {return null;}

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

    };

    

  </script> 

 </head> 

 <body> 

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

 </body>

</html>


提问者:cc超 2016-04-07 11:33

个回答

  • 那一年美然
    2016-04-07 11:41:50
    已采纳

      window.open('http://www.imooc.com/','about_blank','width=400,height=500,toolbar=no,menubar=no')

    引号的使用要注意

  • Hew_520
    2016-04-08 16:44:45

    <html>
     <head>
      <title> new document </title> 
      <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>  
      <script type="text/javascript"> 
       
       function openWindow(){
           var xinxi=prompt("是否打开:","http://www.imooc.com/");
           if(xinxi==ture)
          
           {windows.open('http://www.imooc.com/','_blank','width=400,height=500,menubar=no,took=lbar=no')
           
           }
           else
           {return null;}
           }
      
       
      </script>
     </head>
     <body>
       <input type="button" value="新窗口打开网站" onclick="openWindow()" />
     </body>
    </html>

  • cc超
    2016-04-07 12:07:41

    哎呀。 onclick="openWindow()"忘记改了0-0