Javascript progress bar effect implementation code arrangement _ javascript skills

Source: Internet
Author: User
The progress bar effect implementation code helps ease the slow page display. The first method is to give the user a wait time effect:
Loading. js

The Code is as follows:


// Frequency
Var frequency = 50;
// Step size
Var step = 3;
// Background color
Var loadingBgcolor = "# ffffff ";
// Width
Var loadingWidth = 354;

/*
* Parameter description:
* Content: the displayed content. It can be blank;
* ImageURL: set the path of the referenced JS file;
* Left: the position where the progress bar is displayed. left
* Top: top of the display position on the progress bar
*/
Function Loading (content, imageURL, left, top)
{
ImageURL = imageURL + "Loading.jpg ";

LoadTable (content, imageURL, left, top );
Showimage. style. display = "";
Window. setInterval ("RefAct ();", frequency );
}

Function RefAct ()
{
ImgAct. width + = step;
If (imgAct. width> loadingWidth-4)
{
ImgAct. width = 0;
}
}

Function LoadTable (content, imageURL, left, top)
{
Var strLoading;
StrLoading = "";
StrLoading + ="

";
StrLoading + ="











";If (content! = ""){StrLoading + =" ";StrLoading + =" ";StrLoading + =" ";StrLoading + =" ";}StrLoading + =" ";StrLoading + =" ";StrLoading + ="
";
StrLoading + =""+ Content +"";
StrLoading + ="
";
StrLoading + = "";
StrLoading + ="
";
StrLoading + ="

";

Document. getElementById ("loading_p"). innerHTML = strLoading;
}


Usage page:

The Code is as follows:





Untitled Document

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.