Javascript to implement a simple progress bar

Source: Internet
Author: User
Regardless of the language used for development, the progress bar is often used in file upload and download. This article will share with you two simple progress bars for javascript implementation, one for personal production and the other for netizens, they are all very good. we recommend them to coders here. For more information about coders, see. Example 1:


  Process Bar《script》var t; function s(c){  if(c<=100)  {    val.style.width=c+"%";    percent.innerHTML=c+"%";    btn.disabled=true;    btnp.disabled=false;    c=c+10;    t=setTimeout("s("+c+")",500);  }  else  {    clearTimeout(t);    btnc.disabled=false;    btnp.disabled=true;    return;  }} function c(){  clearTimeout(t);  val.style.width="0px";  percent.innerHTML="0%";  btn.disabled=false;  btnc.disabled=true;  btnp.disabled=true;  btnp.value='Pause';} function p(){  var temp;  if('Pause' == btnp.value)  {    clearTimeout(t);    btnp.value='Go on';    btnc.disabled=false;  }  else  {    temp=val.style.width;    btnp.value='Pause';    var k=parseInt(delEnd(temp));    s(k);    btnc.disabled=true;  }  } function delEnd(str){  var temp="";  for(var i=0; i < str.length-1; i++)   {    temp=temp+str[i];  }   return temp; }《script》 

0%




Let's share a. net

Create a WEB project, add a new project> HTML page, and name it progressbar.htm. the content is as follows:

  No title page  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.