請問,為什么輸入網(wǎng)址為空時,沒有跳出“您未輸入網(wǎng)址”的消息框
<script type="text/javascript"> ?
? ? function openWindow()
{ var mychar=confirm("是否打開?");// 新窗口打開時彈出確認框,是否打開
? ? if(mychar==true)
? { var mywebsite=prompt("請輸入打開的網(wǎng)址:","http://idcbgp.cn/");// 通過輸入對話框,確定打開的網(wǎng)址,默認為 http://idcbgp.cn/
? ? if(mywebsite!=null)
? ? {
? ? ? ? window.open(mywebsite,'_blank','width=400,height=500,menubar=no,toolbar=no');
? ? }
? ? else
? ? {
? ? ? ? alert("您未輸入網(wǎng)址!");
? ? }
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? }
} ?
? </script>?
2016-03-02
把null改成"",空地址就會提示了