jeudi 23 juin 2016

Checkbox when unchecked

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.

Live

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