If statement inside if statement not funcitoning | بلاگ

If statement inside if statement not funcitoning

تعرفه تبلیغات در سایت

آخرین مطالب

امکانات وب

Vote count: 0

So, I'm trying to make a game to help me get better at JS, and I'm trying to set a system where it will not repeat the clear the interval, effectively starting over the loading bar if a certain value is met, but it constantly clears the interval even though said value is not met. You can see the if statement inside of the first, but it seems to be overruling the interior if statement. Any help? Again please excuse me if its obvious I'm very new to this.

    function click_01() {
    var elem = document.getElementById('trash_02');
    var id = setInterval(frame, 10);
    var width = 1;
    function frame(){
       if (width >= 100) {
            if (man_01 === 0) {
              clearInterval('id');
            }
            elem.style.width = 0 + '%';
            width = 0;
            cash = cash + (Math.pow(trashcan, 1.7));
            update();
            document.getElementById('trash').disabled = false;
       } else {
            width++;
            elem.style.width = width + '%';
            document.getElementById('trash').disabled = true;
       }
      }
    }
asked 1 min ago
Ben

...
نویسنده : استخدام کار بازدید : 9 تاريخ : سه شنبه 15 اسفند 1396 ساعت: 5:59