All the friends who have used software know that the progress bar is an important part of a good software.
Its existence enables users to grasp the program running Progress in time and confirm that the application works normally. However, ASP does not seem to have the above standard controls, and it is also troublesome to control them.
So how to implement the progress bar?
Some of my views are as follows (for reference only)
We usually use a page (*. asp) to process or control these programs, and then jump to the display page when the processing is complete. Then we can display the progress bar through these processing pages. The method is to draw one hundred identical images (such as colored rectangles) in sequence based on the Program processing progress to form a progress bar. The effect is similar to that achieved by other programming tools.
The following are some sources that I hope will inspire you.
Response. buffer = true
Dim lostnum
Dim shownum
The delayshow (dstep, dmax) process is used to display the number of img (the progress)
Dmax indicates the number of dmax steps that the entire program needs to process to complete the entire processing program.
Dstep indicates that the current processing step occupies the component of the entire processing process, expressed in quantity.
The existence of the variable lostnum is caused by the dmax being too large (such as 10000), and The dstep being too small (such as 1. If delayshow () is called, it is impossible to draw an img. In fact
Delayshow (1%, 100) is painted once, indicating that 10000 is completed, because 1% accounts for.
Sub delayshow (dstep, dmax)
Dim total // 100 images displayed
Dim dtemp // transition variable
Total = 100
Dtemp = dstep
Dstep = dstep + lostnum
If (dstep * total)/dmax <1 then
// Judge whether the number of items to be processed is even less than 1%. If you do not draw img, use the variable lostnum to store the total number of unpainted items, so that you can process the items during the next call.
Lostnum = lostnum + dtemp
Else
For ccc = 1 to fix (dstep * total)/dmax) // obtain the integer
Response. Write "Next
Response. Flush // display the cached items (images)
// The variable shownum is used to store the currently drawn img.
Shownum = shownum + fix (dstep * total)/dmax)
Lostnum = 0
End if
End sub
// Because of algorithm problems, the remainder is mainly used to make it impossible to draw 100 times completely.
In the process of showlost (), the remaining undrawn img can be displayed and processed to realize the equal length of the progress bar.
Sub showlost ()
For ccc = 1 to (100-shownum)
Response. Write (" ")
Next
Response. Write "<BR>"
Response. Flush
End sub
Note
Cache Technology is required here
Response. buffer = true;
Response. flush;
Response. end
For more information, see the MSDN help.