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

为什么打不开

<!DOCTYPE html>

<html>

 <head>

  <title> new document </title>  

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

  <script type="text/javascript">  

function p()

{var open=confirm("确认新建窗口打开网站吗?");

if(open==true)

{var ur=prompt("通过输入对话框,确定打开的网址","http://www.imooc.com");

if(ur!=null)

window.open("ur""blank""width=400px,heighr=500px,menubar=no,toolbar=no");

else

alert("再见!");

}   

else

{alert("再见!");}

}

 </script> 

 </head> 

 <body> 

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

 </body>

</html>

为什么运行不了??????????????????明明挺对的,求大神解答

正在回答

2 回答

window.open("ur""blank""width=400px,heighr=500px,menubar=no,toolbar=no");

改为window.open(ur,"_blank","width=400px,heighr=500px,menubar=no,toolbar=no");

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

枫雪翊 提问者

还是运行不了,急
2015-01-19 回复 有任何疑惑可以回复我~
#2

Justicer_P 回复 枫雪翊 提问者

ur!=null 这里不行,直接用if判断ur,不要判断ur!=null,为什么呢?我也不知道。。
2015-01-19 回复 有任何疑惑可以回复我~
#3

Justicer_P 回复 枫雪翊 提问者

同样,不要判断open==true,直接判断open
2015-01-19 回复 有任何疑惑可以回复我~

举报

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

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

进入课程

为什么打不开

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