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