大神們 看看哪里出問(wèn)題了?
<!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("是否打開(kāi)新建窗口");
?if(open==true)
{
?var np=prompt("請(qǐng)輸入網(wǎng)址","http://idcbgp.cn/");
?if(np==null)
{
?window.open(np,"width=500,height=40,menubar=no,toolbar=no");
}
?else{alert("ko");}
}
?else{alert("ko");}
}
???
???
? </script>
?</head>
?<body>
?? <input type="button" value="新窗口打開(kāi)網(wǎng)站" onclick="openWindow()" />
???
?</body>
</html
2016-01-02
沒(méi)太看懂你np==null這個(gè)if else想實(shí)現(xiàn)什么意思?
修改了一個(gè):
<!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("是否打開(kāi)新建窗口");
?if(open==true)
{
?var np = prompt("請(qǐng)輸入網(wǎng)址","http://idcbgp.cn/");
?window.open(np,"_blank","width=500,height=40,menubar=no,toolbar=no");
}
?else{alert("ko");}
}
? ??
? ??
? </script>?
?</head>?
?<body>?
? ?<input type="button" value="新窗口打開(kāi)網(wǎng)站" onclick="openWindow()" />?
? ??
?</body>
</html>