我這樣理解有錯(cuò)嗎?
? ?function openWindow(){
var name
var open
name=confirm("是否打開")
open=prompt("確定打開網(wǎng)址"," http://idcbgp.cn/")
if (name==true){
? ? alert(open);if (open!==null){window.open(url,'_blank','width=400px','height=500px','menubar=no','toolbar=no')}
? ? else{alert("沒有輸入喔")}
}
else{alert("thank you");}}
2016-08-19
請把if(name==true)放在"open=prompt(......)"語句前面。邏輯是:1.先判斷是否打開,如果點(diǎn)“確定”則name=true;2.當(dāng)name==true的時(shí)候,再執(zhí)行open=prompt("確定打開網(wǎng)址"," http://idcbgp.cn/"),讓用戶輸入網(wǎng)址。請注意'width=400px','height=500px','menubar=no','toolbar=no'應(yīng)改為‘width=400px,height=500px,menubar=no,toolbar=no',作為window.opne的第三個(gè)參數(shù)。
2016-08-19
其實(shí)我感覺沒什么錯(cuò)誤,只是在alert(open);這一句會有額外的提示信息,在使用的過程中操作較為繁瑣一些,邏輯上沒什么錯(cuò)誤。
2016-08-19
你的兩個(gè)彈出框是一起執(zhí)行的,他們兩個(gè)不應(yīng)該是有層級關(guān)系的么,這樣的話,當(dāng)你彈出“是否打開”彈出框,無論你點(diǎn)確定或者取消,都會執(zhí)行下一個(gè)彈出框的吧。
2016-08-19
寫兩層嵌套的if干嘛,,一層就可以了
2016-08-19
錯(cuò)了,這里不需要?alert(open),open=prompt("確定打開網(wǎng)址"," http://idcbgp.cn/"),這一句就是選擇確定輸入的網(wǎng)站