javascript - Working with a timer and progress bar in JS -


i trying create simple script user clicks button , progress bar fills 100% (i know exciting right?)

so have snippet set timer:

this.updatebar = setinterval(function () { that.update(); }, 50); 

the problem having writing method progress bar fills up. quite having logic errors i'm in deep can't see them. have incomplete doesn't me off ground start.

progressbar.prototype.update = function () {    if(this.bar.style.width == "0%")    {        this.bar.style.width = "20%";    }  } 

thank you!

inside progressbar constructor, add:

this.progress = 0; 

then change update function to:

progressbar.prototype.update = function () {     this.progress++;      this.bar.style.width = this.progress + "%"; } 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -