为了账号安全,请及时绑定邮箱和手机立即绑定

请问为什么无法运行

<!DOCTYPE html>

<html>

 <head>

  <title> new document </title>  

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

  <script type="text/javascript">  

    function openwinfow()

    {var message=confirm("是否打开?");

    if (message=ture)

    {var open2=prompt("请输入网址");

    if (open2=ture){

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

    }

    else{alert("谢谢");} 

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

    else{alert("谢谢");}

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


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

    

    }

  </script> 

 </head> 

 <body> 

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

 </body>

</html>


正在回答

2 回答

<!DOCTYPE html>

<html>

 <head>

  <title> new document </title>  

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

  <script type="text/javascript">  

    

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

    function openWindow(){

       // window.open('http://www.imooc.com/','_blank','width=400,height=500');

       var wang='http://www.imooc.com/';

        var score=confirm('是否要打开新窗口');

        if(score==true){

           var hh;//1.需要先定义

           hh=prompt("请输入网址",wang);//再赋值

             if(hh!=null){

                window.open(wang,'_blank','width=400,height=500');

            }

        }

        

    }

    

    // 通过输入对话框,确定打开的网址,默认为 


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

    

    

  </script> 

 </head> 

 <body> 

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

 </body>

</html>

这是我写的,可以参考参考

1 回复 有任何疑惑可以回复我~

不弹出新窗口 改怎么改?

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
JavaScript入门篇
  • 参与学习       738461    人
  • 解答问题       9561    个

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

进入课程

请问为什么无法运行

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信