麻煩大家看看我的代碼 怎么執(zhí)行后沒有反應(yīng)啊.
大家能不能看看我的代碼怎么 執(zhí)行之后沒有反應(yīng)啊 ...我的瀏覽器是chrome
代碼如下:
<!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 open=confirm("是否要打開窗口?");//新窗口打開時(shí)彈出確認(rèn)框,是否打開
? ? ? if(open==ture)
? ? ? {var url=prompt("輸入網(wǎng)址","http://idcbgp.cn");
? ? ? if(url!=null)
? ? ? {window.open("url");
? ? ? else
? ? ? { alert("再見");}
? ? ? else
? ? ? { alert("再見");}
? ? }
? ??
? ??
? </script>?
?</head>?
?<body>?
?<input type="button" ?value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2017-01-11
<!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 open=confirm("是否要打開窗口?");//新窗口打開時(shí)彈出確認(rèn)框,是否打開
? ? ? if(open==true)
? ? ? {
?var url=prompt("輸入網(wǎng)址","http://idcbgp.cn/");
? ? ? if(url!=null)
? ? ? {
?window.open(url);
?}
? ? ? else
? ? ? {?
?alert("再見");
?}
? ? ?
?}?
?else
? ? ? {?
?alert("再見");
?}
? ? }
? ??
? ??
? </script>?
?</head>?
?<body>?
?<input type="button" ?value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2017-01-11
window.open("url");這句改成window.open(url);
2017-01-11
你的true寫錯(cuò)了。應(yīng)該是true而不是ture;