如果满足条件,我如何运行第二个if语句,然后再不运行

时间:2018-04-03 13:50:01

标签: javascript

function CheckUpgrades(){
    if(cookies >= 1000){
        document.getElementById("upgrades").style.removeProperty("display");
    }
    if (clickMultiplier == 2){
        document.getElementById("upgrades").style.display = "none";
        //cookies = cookies - 500; MAKES IT GO IN REVERSE
    }
}

我在一个区间内有这个,因为我需要继续检查条件。

1 个答案:

答案 0 :(得分:0)

我将代码更改为修复它的代码。

var upgradeBought = false; var upgradePossible = false;

function CheckUpgrades(){     if(upgradePossible){         if(!upgradeBought)document.getElementById("升级")。style.removeProperty(" display");         else document.getElementById("升级")。style.display =" none&#34 ;;     }

if(cookies >= 1000) upgradePossible = true;

} 的setInterval(CheckUpgrades 1000/60);