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://idcbgp.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
兩次窗口是點擊取消才會出現(xiàn),因為你的else又調(diào)用了alert消息對話框
2017-12-21
因為用了IF ELSE語句,然后設(shè)置了