Javascript jquery css Write simple progress bar control _jquery

Source: Internet
Author: User
Through our great CSS, we can achieve a very beautiful progress bar style. With the effect of Javascript, we can completely "deceive" our users, so that they have the patience to wait for the browser to complete the process. The above principle already knew, then can see the code directly. I'm using the jQuery framework, because it might be easier to understand the short code.

Of course there's a lot more to be done with this control, and I'm just offering a way to follow WEB standards. Don't say much nonsense.
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 strict//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" > <p tml xmlns= "http://www.w3.org/1999/xhtml" > <pead> <meta http-equiv= "Content-type" content= "text/h" Tml Charset=utf-8 "/> <title>javascript Progress Bar demo-jb51.net</title> <script type= "Text/javascript" src= "http://www.jb51.net/jslib/jquery/jquery.js" ></script> <style type= "Text/css" &G T #progress {background:white; height:20px; padding:2px; border:1px solid green; margin:2px;} #progress span {background:green; height:16px; text-align:center; padding:1px; margin:1px; Display:block; Color:yellow; Font-weight:bold; font-size:14px; width:0%;} </style> <script type= "Text/javascript" > var progress_node_id = "Progress"; function Setprogress (progress) { if (progress) {$ ("#" + progress_node_id + "> span"). CSS ("width", String (Progress) + "%"); $ ("#" + progress_node_id + "> span"). HTML (String (Progress) + "%"); } var i = 0; function doprogress () {if (i >) {alert ("Progress Bar finished!"); Return } if (I <=) {settimeout ("doprogress ()", 500); Setprogress (i); i++; } $ (document). Ready (function () {doprogress (); }); </script> </pead> <body> <p>javascript progress bar demo</p> <p> principle is to use Javascrip t controls the width of the SPAN CSS (as well as other styles), see link:http://www.jb51.net/article/13993.htm</p> <div id= "Progress" For more information ><s Pan> </span></div> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

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.