无答案,求正解

来源:2-7 编程练习

刘妹妹

2015-07-20 11:18

无答案,求正解

写回答 关注

2回答

  • 寒江北去
    2015-07-20 15:14:50
    <!DOCTYPE html>
    <html>
     <head>
      <title> new document </title>  
      <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>   
      <script type="text/javascript">  
    
        // 新窗口打开时弹出确认框,是否打开
        // 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/
        function openWindow()
    	{
    		var userConfirm=confirm("是否打开");
    		if(userConfirm==true)
    		{
                var userPromote;
                userPromote=prompt("是否打开","www.imooc.com");
    			//打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。
    			if (userPromote!=null)
    			{
    				window.open(userPromote,'_blank','width=400,height=500,menubar=no,toolbar=no');
    			}
                 else
                {
                    alert('用户点了取消按钮');
                }
    		}
            else
            {
                alert('用户点了取消按钮');
            }
    	}    
      </script> 
     </head> 
     <body> 
    	  <input type="button" value="新窗口打开网站" onclick="openWindow()" /> 
     </body>
    </html>


    寒江北去 回复刘妹妹

    多顺顺,练练就好了

    2015-07-21 08:14:28

    共 2 条回复 >

  • Perona
    2015-07-20 11:20:02

    可以参考下同学代码哦~~

    刘妹妹

    嗯啦~

    2015-07-20 22:58:15

    共 1 条回复 >

JavaScript入门篇

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

741122 学习 · 9865 问题

查看课程

相似问题