帮我看看我的代码哪里错了?请各位大神指教!

来源:2-7 编程练习

慕神3775235

2015-09-04 11:31

<!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 webopen=confirm('是否确定打开百度搜索?');
    if(webopen==true)
    {
        window.open('http://www.baidu.com','百度','width=800px,height=900px,menubar=no,toolbar=no,status=no,scrollbars=yes');
    }
    else
    {
        document.write('nothing');
    }
    }
    // 新窗口打开时弹出确认框,是否打开

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

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

写回答 关注

2回答

  • arlenhui
    2015-09-05 20:51:39
    已采纳
    <!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 webopen=confirm('是否确定打开百度搜索?');
        if(webopen==true)
        {
            window.open('http://www.baidu.com','百度','width=800px,height=900px,menubar=no,toolbar=no,status=no,scrollbars=yes');
        }
        else
        {
            document.write('nothing');
        }
        }
        // 新窗口打开时弹出确认框,是否打开
    
        // 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/
    
        //打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。
        
        
      </script> 
     </head> 
     <body> 
          <input type="button" value="新窗口打开网站" onclick="openWindow()" /> 
     </body>
    </html>


    慕神3775...

    非常感谢!

    2015-09-05 22:49:54

    共 1 条回复 >

  • haodaking
    2015-09-04 13:59:09

    '百度',后边的逗号有问题,修改成英文状态下的逗号

JavaScript入门篇

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

741114 学习 · 9865 问题

查看课程

相似问题