function openWindow()
{var open = confirm ('open new window!');
if (open==true)
{var url = prompt('open this web', 'www.google.ca');
if (url!=null)
{window.open(url,"_blank",'width=400px,height=500px,menubar=no,toolbar=no');}
else{
alert('bye')
}
else{
alert('bye')
}
}
}
代码本身有问题,第一个else后面应该有两个括号,第二个else后面应该只有两个括号
function openWindow()
{var open = confirm ('open new window!');
if (open==true)
{var url = prompt('open this web', 'www.google.ca');
if (url!=null)
{window.open(url,"_blank",'width=400px,height=500px,menubar=no,toolbar=no');}
else{
alert('bye')
}
}
else{
alert('bye')
}
}
<script type="text/javascript">
function openWindow(){
var mywindow=confirm("是否打开");
if(mywindow==true){
window.open('http://www.imooc.com/','-blank','width=400,height=500,menubar=no,toolbar=no')
}
}
</script>
好的谢谢