大神們 看看哪里出問題了?
<!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 np=prompt("請輸入網址","http://www.xianlaiwan.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="新窗口打開網站" onclick="openWindow()" />
???
?</body>
</html
2016-01-02
沒太看懂你np==null這個if else想實現什么意思?
修改了一個:
<!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 np = prompt("請輸入網址","http://www.xianlaiwan.cn/");
?window.open(np,"_blank","width=500,height=40,menubar=no,toolbar=no");
}
?else{alert("ko");}
}
? ??
? ??
? </script>?
?</head>?
?<body>?
? ?<input type="button" value="新窗口打開網站" onclick="openWindow()" />?
? ??
?</body>
</html>