為什么不能彈出網(wǎng)頁(yè)
<!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 a;
? ? ? ? a=confirm("要打開(kāi)網(wǎng)址嗎");
? ? ? ? var b;
? ? ? ? b=prompt("請(qǐng)輸入網(wǎng)址"," http://idcbgp.cn/");
? ? ? ? ? ? if(a==true){
? ? ? ? ? ? ? ? if(b==true){
? ? ? ? ? ? ? ? ? ? window.open("http://idcbgp.cn/","_blank","height=500,width=400")
? ? ? ? ? ? ? ? }else ("你選擇了取消")
? ? ? ? ? ? }else ("你選擇了取消")
? ? ? ? }
? ? // 新窗口打開(kāi)時(shí)彈出確認(rèn)框,是否打開(kāi)
? ? // 通過(guò)輸入對(duì)話框,確定打開(kāi)的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
? ??
? ? //打開(kāi)的窗口要求,寬400像素,高500像素,無(wú)菜單欄、無(wú)工具欄。
? </script>?
?</head>?
?<body>?
? <input type="button" value="新窗口打開(kāi)網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2019-05-13
var a 后面的分好改成 英文字符。 變量b的值是“http://idcbgp.cn/”? 所以if(b==true) 判斷不成立