function openWindow(){
var YN=confirm("是否打开新窗口?")
if(YN==true){
var newwindow=prompt("请输入地址:","http://www.imooc.com/");
if(newwindow!=null){
window.open('newwindow','_blank','width=400,height=500');
}
else{
alert("2");
}
}
else{
alert("1");
}
解决了少写了个function的},妈耶好蠢