<!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 message=confirm("是否打开新世界?");        if(message=true)            {                var url;                url=prompt("请输入你的ID","www.imooc.com/")                 if(url=www.imooc.com/)                {                window.open(url,"_blank","toolbar=no, menubar=no, scrollbars=yes,  width=400, height=400");                }                else                {alert("再见")}            }        else            {alert("再见")}}    // 新窗口打开时弹出确认框,是否打开    // 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/    //打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。          </script>  </head>  <body> 	  <input type="button" value="新窗口打开网站" onclick="openWindow()" />  </body></html>
                    
                    
                1 回答
                        已采纳
                    
                                        
                         
                    
                    
                            李晓健
                            
                                
                            
                        
                        
                                                
                    TA贡献1036条经验 获得超461个赞
<!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 message=confirm("是否打开新世界?"); //你这里写了中文分号
        if(message=true)
        {
            var url;
            url=prompt("请输入你的ID",/*你这里写了中文逗号,网址是http开头*/"http://www.imooc.com/")
            if(url==='http://www.imooc.com/' /*这里字符串要加引号,判断相等是 == 或 === ,= 是赋值不是判断*/)
            {
                window.open(url,"_blank","toolbar=no, menubar=no, scrollbars=yes,  width=400, height=400");
            }
            else
            {alert("再见")}
        }
        else
        {alert("再见")}}
        // 新窗口打开时弹出确认框,是否打开
        // 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/
        //打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。
    </script>
</head>
<body>
<!--这里的方法名也写错了 w是小写-->
<input type="button" value="新窗口打开网站" onclick="openwindow()" />
</body>
</html>- 1 回答
- 0 关注
- 1359 浏览
相关问题推荐
添加回答
举报
0/150
	提交
		取消
	