confirm()彈出兩次窗口
<!DOCTYPE?HTML>
<html>
<head>
<meta?http-equiv="Content-Type"?content="text/html;?charset=utf-8"?/>
<title>close()</title>
??<script?type="text/javascript">
?????var?mywin=window.open("http://www.xianlaiwan.cn");
????if(confirm("is?you?want?to?close??")){
????????mywin.close();
????}else{
????????alert("now?it?is?open!");
????}
??</script>
</head>
<body>
</body>
</html>萌新問一句,為什么會彈出兩次confirm窗口呢?
2018-07-28
兩次窗口是點擊取消才會出現,因為你的else又調用了alert消息對話框
2017-12-21
因為用了IF ELSE語句,然后設置了