想知道如果有人能引导我走向正确的方向,我正在尝试使用Javascript来制作一个小游戏来帮助我学习。从本质上讲,我声明了所有我想要在我的函数外部进行更改的变量,以便它们作用于代码中的全局函数,但if语句似乎没有证明是成功的,因为教程指出我的代码是正确的,请参阅下面的代码;Javascript - if statement error
var Refresh;
Refresh = "InActive";
var Counter;
Counter = 0;
var StartTime;
function StartGame() {
var StartDate;
StartDate = new Date();
StartTime = d.getTime();
Refresh = "Active";
}
function FunctionB1() {
if (Refresh == "Active"){
document.getElementById("Bean1").style.display = "None";
Counter ++;
document.getElementById("BeanCount").innerHTML = Counter + " Out of 150";
}
}
我看不到'var Refresh'在您的发布代码中的任何位置声明。 –
@GlenDespaux第一行... – Teemu
啊我看到了,它没有放入代码块。对不起,关于 –