rob wrote:
Hi All,
I have an asp script which updates upto 300000 records each time it
is run. I would like to have a textbox which says records progressed
: then in increments of 100 or 1000 whilst the script is running. Is
this possible to do with a textbox? I've tried using the
response.flush with a variable which kinda works but it displays as
How about a progress bar. Like this:
<%@ Language=VBScript %>
<%Response.Buffer=true%>
<HTML><BODY>
<style type="text/css">
..pBar {
border: thin inset black;
background-color:navajowhite;
padding-left:5px;
padding-right:5px
}
div.1 {
border-top:5px solid navajowhite;
border-bottom:5px solid navajowhite;
text-align: left;
background-color: navajowhite;
width: 100%;
height: 10px;
}
div.2 {
border-top:5px solid navajowhite;
border-bottom:5px solid navajowhite;
text-align: right;
background-color: blue;
color:white;
height: 10px;
}
</style>
<span id=spTime></span><BR>
<div id=progressBar class=pBar>
<div id="hr1" class=1></div></div>
<script type="text/jscript">
var timeID
function doit() {
var nPercent = Number('1');
var curwidth=Number(hr1.style.width.replace("%",""));
hr1.className="2";
var newWidth=curwidth + Number(nPercent);
if (newWidth % 20 == 0)
{
spTime.innerText=newWidth
}
if (newWidth > 100){
newWidth = 0
}
hr1.style.width= newWidth + "%";
timeID = setTimeout("doit()",100);
}
//spTime.innerText="0.1"
setTimeout("doit()",100);
</script>
<%
'Here is where the long-running script starts
dim t,diff
Response.Flush
t=now
do until diff > 5
diff = DateDiff("s",t,now)
loop
'Response.Flush
%>
<!--the rest of the page follows here-->
</BODY>
<script type="text/jscript">
clearTimeout(timeID);
progressBar.style.display="none";
spTime.innerText="Finished";
</script>
</HTML>
HTH,
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"