Im trying to make a checkbox do a timing event when it's checked, and stops when unchecked. It works when checked, but when I uncheck it, it just do the function again, the variable just getting higher faster.
JS Code
var money = 0;
function moneyMaker(){
money++;
document.getElementById('money').innerHTML = money;
}
function doautoMoney(){
window.setInterval(function(){
moneyMaker();
document.form.automoney.click();
//alert('Auto Saved!');
}, 1000);
}
Aucun commentaire:
Enregistrer un commentaire