weixin_慕先生4035002
2020-09-05 05:20
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>
好的谢谢
JavaScript入门篇
739817 学习 · 9566 问题
相似问题