prompt為null的情況
var url=prompt("通過(guò)輸入對(duì)話框,確定打開(kāi)的網(wǎng)址","http://idcbgp.cn");
? ? ? ? ? ? ? ? if(url!=null){
? ? ? ? ? ? ? ? ? ? window.open(url,"_blank",'width=400px,height=500px,menubar=no,toolbar=no');?
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? else{alert("再見(jiàn)!");}
? ? ? ? ? ? ? ? ? ? }
請(qǐng)問(wèn)這段代碼為啥在輸入的時(shí)候?yàn)榭?,點(diǎn)確認(rèn)為什么還是打開(kāi)了網(wǎng)頁(yè),而不是判斷為NULL而彈出再見(jiàn)的窗口?
2016-09-12
window.open("http://idcbgp.cn","_blank",'width=400px,height=500px,menubar=no,toolbar=no');?
window.open 的第一個(gè)參數(shù)是你要打開(kāi)的網(wǎng)址 如果不填就是空白頁(yè)
2016-09-12
if 語(yǔ)句內(nèi)容應(yīng)該為 url!=""