if語(yǔ)句不滿足條件
function diakai()
{
var wangzhi=("http://cdn.store.steampowered.com/");
var wangzhiqr=prompt("請(qǐng)輸入網(wǎng)址","默認(rèn)打開(kāi)steam");
if(wangzhiqr==true)
{
document.write("保護(hù)好你的手");
window.open(wangzhiqr);
}
else
{
document.write("那就撿垃圾吧");
window.open("http://tieba.baidu.com/f?kw=%CF%D4%BF%A8&fr=ala0&tpl=5");
}
}
if語(yǔ)句為什么不滿足條件啊
2017-06-22
prompt函數(shù)返回的是打開(kāi)的網(wǎng)址,按取消返回null,你怎么用了判斷真假,還有你的prompt函數(shù)的第二個(gè)參數(shù)應(yīng)該改為wangzhi吧,自己定義的默認(rèn)輸入網(wǎng)址。
2017-06-22
function diakai()
{
var wangzhiqr=prompt("請(qǐng)輸入網(wǎng)址","默認(rèn)打開(kāi)steam");
if(wangzhiqr!=null)
{
document.write("保護(hù)好你的手");
window.open("http://store.steampowered.com/");
}
else
{
document.write("那就撿垃圾吧");
window.open("http://tieba.baidu.com/f?kw=%CF%D4%BF%A8&fr=ala0&tpl=5");
}
}
這么寫(xiě)對(duì)了吧