這有什么問題呢?怎么打不開窗口
<!DOCTYPE html>
<html>
?<head>
? <title> new document </title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> ??
? <script type="text/javascript"> ?
? ??
? ? // 新窗口打開時(shí)彈出確認(rèn)框,是否打開
? ? // 通過輸入對(duì)話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ? function openWindow(){
? ? ? ?var open;
? ? ? ?open=prompt("確定打開新窗口嗎?");
? ? ? ?if(open==ture){
? ? ? ? ? var url=prompt("請(qǐng)輸入你要打開的網(wǎng)站地址!","http://idcbgp.cn/")
? ? ? ? ? ?if(url!=null){
? ? ? ? ? ? ? window.open("http://idcbgp.cn/","_blank",width=400,height=500,toolbar=no,menubar=no); ?
? ? ? ? ? ?}
? ? ? ? ? ?else{
? ? ? ? ? ?alert("bye");
? ? ? ? ? ? }
? ? ? ?}
? ? ? ?else{
? ? ? ? ? alert("GOODBYE");
? ? ? ?}
? ? ??
? ? }
? ??
? ??
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2018-09-25
window.open()里面的變量都是單引號(hào),你用的是雙引號(hào)所以錯(cuò)了
2018-09-19
你定義open之后寫的第一個(gè)彈框應(yīng)該是confirm,confirm彈框的值才是布爾類型。你看看是不是打錯(cuò)了打成prompt了