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 + =""+ Content +"";
StrLoading + =" | ";StrLoading + ="
";StrLoading + ="
";}StrLoading + ="
";
StrLoading + = "";
StrLoading + =" | ";StrLoading + ="
";StrLoading + ="
";
StrLoading + ="
";
Document. getElementById ("loading_p"). innerHTML = strLoading;
}
Usage page:
The Code is as follows:
Untitled Document