【发布时间】:2016-05-12 23:16:09
【问题描述】:
如果变量太高或太低,是否可以有一个停止和启动的反转函数
我怎样才能让赚钱者在达到 300 时停止?
我尝试使用此代码,但没有得到任何结果...
代码前。
var money = 0;
var maxmoney = 300;
var moneymaker = window.setInterval(function(){
money = money + 1;
document.getElementById('money').innerHTML = money;
}, 1000);
function stopInter(){
if(hp >= maxhp)
clearInterval(regen);
}else{
setTimeout(function(){}, 1000);
}
}
【问题讨论】:
标签: javascript timer