<!DOCTYPE html><html>?<head>? <title> new document </title> ?? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> ??? <script type="text/javascript"> ?? function openWindow(){? ? var creatNewWindow=confirm("是否需要百度?");? ? // 新窗口打開時彈出確認框,是否打開? ? if(creatNewWindow=true)? ? {? ? ? ? window.open('https://www.baidu.com/','_blank');? ? }? ? // 通過輸入對話框,確定打開的網(wǎng)址,默認為 http://idcbgp.cn/? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。? ? else{? ? ? ? document.write("不跟你玩了!");? ? ? ? alert("給你一個大嘴巴子!");? ? }}? ??? </script>??</head>??<body>??<input type="button" value="百度一下" onClick="openWindow()">?</body>?</html>
confirm 為啥我點了取消還是打開了窗口?
qq_咖啡新東方_0
2017-08-01 17:55:48