HTML progress bars

Source: Internet
Author: User

Method 1:

<HTML>

<Head>
<SCRIPT type = "text/JavaScript">
VaR mytimer = NULL; var bar = 0;
Function processbar (){
If (Bar <200 ){
Bar ++;
Document. getelementbyid ("processbar"). style. width = BAR + "PX ";
Mytimer = Window. setTimeout ("processbar ()", 50 );
}
}
Function startbar (){
Mytimer = Window. setTimeout ("processbar ()", 50 );
}
Function pausebar (){
Window. cleartimeout (mytimer );
}
</SCRIPT>
</Head>

<Body>
<Div style = "width: 200px; Height: 10px; Border: solid 1px # CCC; padding: 1px;">
<Div id = "processbar" style = "background-color: #90ee90; width: 0px; Height: 10px;"> </div>
</Div>
<Input type = "button" value = "start" onclick = "startbar ();"/>
<Input type = "button" value = "pause" onclick = "pausebar ();"/>
</Body>

</Html>

Method 2:

<HTML>
<Head>
<SCRIPT type = "text/JavaScript">
VaR mytimer = NULL; var bar = 0;
Function processbar (){
If (Bar <200 ){
Bar ++; document. getelementbyid ("processbar"). style. width = BAR + "PX ";
}
}
Function startbar (){
Mytimer = Window. setinterval ("processbar ()", 50 );
}
Function pausebar (){
Window. clearinterval (mytimer );
}

</SCRIPT>
</Head>

<Body>
<Div style = "width: 200px; Height: 10px; Border: solid 1px # CCC; padding: 1px;">
<Div id = "processbar" style = "background-color: #90ee90; width: 0px; Height: 10px;"> </div>
</Div>
<Input type = "button" value = "start" onclick = "startbar ();"/>
<Input type = "button" value = "pause" onclick = "pausebar ();"/>
</Body>
</Html>

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.