为什么点了“取消”网页还是会出现?
谢谢各位大神,帮忙看一下,为什么不管点“确认“还是”取消”网页都会出现
谢谢各位大神,帮忙看一下,为什么不管点“确认“还是”取消”网页都会出现
2019-06-15
你这样写当然会出现问题了,即使你点击了取消,下面的你的ddd赋值语句依旧执行,所以会弹出网页,改一下就行
你试着这样写就不会有问题了
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript">
function www(){
var a = confirm("是否打开网页?");
if(a==true){
window.open("http://www.baidu.com","_blank","width:400px,height=400px");
}else{
alert("拜拜");
}
}
</script>
</head>
<body>
<input type="button" value="点击打开此网页" onclick="www()"/>
</body>
</html>举报