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