2-7 编程练习
本节编程练习不计算学习进度,请电脑登录imooc.com操作

编程练习

制作新按钮,“新窗口打开网站” ,点击打开新窗口。

任务

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

提示: 使用 if 判断确认框是否点击了确定,如点击弹出输入对话框,否则没有任何操作。

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

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

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title> new document </title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>
  6. <script type="text/javascript">
  7.  
  8. // 新窗口打开时弹出确认框,是否打开
  9.  
  10. // 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/
  11.  
  12. //打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。
  13.  
  14.  
  15. </script>
  16. </head>
  17. <body>
  18. <input type="button" value="新窗口打开网站" onclick="openWindow()" />
  19. </body>
  20. </html>
下一节