請問為什么我寫的不行
<!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("確認(rèn)開網(wǎng)頁嗎?")};
?if(open=true)
?{var url=prompt("請輸入網(wǎng)址"."http://www.baidu.com/")};
?if(url!=null)
?{window.open(url,"_blank",'width=400px,height=500px,menubar=no,toolbar=no'}
? else
? {alert("88!")}
? else
? {alert("88!")}
??
? </script>?
?</head>?
?<body>?
? ? ? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2016-04-10
?? function openWindow(){
????? var s=confirm("打開嗎?");
????? if(s==true){
????? var y=prompt("打開什么?");
????? if(""!==y&&y!==null){
????? window.open('http://www.baidu.com','width=400,height=500,bar=false')
????? }
?????? else{
????????? alert("我是prompt的else");
????? }
????? }
????? else{
????????? alert("我是confirm的else");
????? }
???? ?
? }
這個應(yīng)該是你想要的
2016-04-08
在編寫時確認(rèn)是在英文狀態(tài)下,有一個;有問題,還有{}沒有括對,window.open后面的括號錯了,編寫沒什么問題
2016-04-08
第一個if的條件判斷,應(yīng)該是 “==”
2016-04-08
if else 邏輯能用{}括起來?