Posted By

cfleschhut on 02/15/10


Tagged

basic javascript animation ProgressBar


Versions (?)

Basic JavaScript Progressbar Animation


 / Published in: JavaScript
 

URL: http://jsfiddle.net/YR9fd/4/

  1. <div id="progress" style="background: green; width: 0;">&nbsp;</div>
  2. <p><a href="#" onclick="progress(); return false;">start</a></p>
  3.  
  4. function progress() {
  5. var loadingbar = document.getElementById("progress");
  6. var width = parseInt(loadingbar.style.width);
  7. width++;
  8. loadingbar.style.width = width + "px";
  9. if (width < 300) {
  10. setTimeout(progress, 10);
  11. }
  12. }

Report this snippet  

You need to login to post a comment.