幫忙看哪里錯了,謝謝
<!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("是否打開新窗口");
? ? if(open==true){
? ? var url=prompt("確定打開的網(wǎng)址","http://idcbgp.cn");
? ? if(url==true){
? ? ? ? window.open(url,"_blank","width=400,heigth=500,menubar=no,toolbar=no");
? ? } else{}
? ? ? else{} ?
? ? }
? ? }
? ? // 新窗口打開時彈出確認框,是否打開
? ? // 通過輸入對話框,確定打開的網(wǎng)址,默認為 http://idcbgp.cn/
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ??
? ??
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2017-06-09
else{}沒有內(nèi)容可以不寫,if(url==true)不對 你可以在后面加個alert(url); 看看url是什么。if(url)就可以了?
2017-06-10
<!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 str=confirm("是否打開頁面");
? ? ? ? if(str==true)
? ? ? ? {
? ? ? ? ? var ?url=prompt("通過輸入對話框,確定打開的網(wǎng)址","http://idcbgp.cn/");
? ? ? ? ? ? if(url)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? window.open(url,"_blank",'width=400px,height=500px,menubar=no,toolbar=no');
? ? ? ? ? ? }
? ? ? ? ? ? else
? ? ? ? ? ? {
? ? ? ? ? ? ? ? alert("再見");
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? else
? ? ? ? {
? ? ? ? ? ? alert("再見");
? ? ? ? }
? ? // 通過輸入對話框,確定打開的網(wǎng)址,默認為 http://idcbgp.cn/
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ??
? ??
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網(wǎng)站" onClick="openWindow()" />?
?</body>
</html>
沒反應(yīng)啊啊啊