Friends who have used the software know that the progress bar is an important part of an excellent software.
Its existence allows users to timely grasp the program's running progress and confirm that the application is working normally. However, there seems to be no standard controls mentioned above in ASP, so it is also troublesome to control.
So how to implement the progress bar?
The following are some of my views (for reference only)
When we use ASP processing programs (referring to writing files or operating databases), we will use a page (*.asp) to process or control these programs, and then jump to the display page when the processing is completed. At this time, we can display the progress bar through these processing pages. The method is to draw a hundred identical figures (such as colored rectangles) in sequence according to the progress of the program processing, thereby forming a progress bar. Its effect is basically similar to that achieved with other programming tools
Here are some Sources, I hope they can inspire you.
response.buffer=true
dimlostnum
dimshownum
delayshow(dstep,dmax) process is used to display how much img (how much progress)
where dmax represents how many (dmax) steps the entire program needs to process to complete the entire process.
where dstep represents the current process steps occupying the component of the entire process, and is 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 you call delayshow(1,10000) it is impossible to draw img once, in fact
Delayshow(100,10000) is only drawn once, indicating that 1% is completed, because 100 accounts for 1% of 10000.
subdelayshow(dstep,dmax)
dimtotal//Display 100 img
dimdtemp//transition variable
Total=100
dtemp=dstep
dstep=dstep+lostnum
if(dstep*total)/dmax<1then
//Judge that when the thing to be processed does not have 1% of the things to be processed, do not draw img and use the variable lostnum to store the total number of untitled processing, so that the next time this process is called.
lostnum=lostnum+dtemp
else
forccc=1tofix((dstep*total)/dmax)//Take an integer
Response.Write"<imgsrc=""../images/delay1.jpg"">"
next
Response.Flush//Show the things (pictures) in the cache
//The variable shownum is used to store the img that has been drawn.
shownum=shownum+fix((dstep*total)/dmax)
lostnum=0
endif
endsub
// Due to the algorithm problem, the main reason is that the remaining amount cannot be completely drawn 100 times, so it is necessary to
The process showlost() displays all the remaining untrawn imgs to realize the equal length of the progress bar
subshowlost()
forccc=1to(100-shownum)
Response.Write("<imgsrc=""../images/delay1.jpg"">")
next
Response.Write"<BR>"
Response.Flush
endsub
Please note at the end
Caching technology is required here
response.buffer=true;
response.flush;
response.end
Please refer to MSDN Help for these