日期:2014-05-17  浏览次数:20823 次

如何中断一个程序的执行
我的做法是这样的
1.asp
<%
    b=1
  <input   type= "button "   value= "中断 "   onclick= "javascript:window.open( '2.asp '); "> <br>
    session( "a ")=1
    while   b <100000
        if   session( "a ")=0   then   exit   while
        s=s+b
        ……   '假设这里执行一下需要2秒钟的时间
    wend
%>

2.asp
<%
  session( "a ")=0
  response.write   " <script> alert( '中断成功 '); </script> "
%>

这样出现的问题是:点击中断后,直到1.asp执行完才执行2.asp,感觉好象1.asp程序执行过程中,session( "a ")不允许改变。如果想实现这样的功能,有什么好的方法?

------解决方案--------------------
response.write "处理完成!10000条. "

改成:

if p <10000 then
response.write "当前进度: <%=p*100\10000 %> %,已处理 <%=p%> 条.... "
else
response.write "处理完成! "
end if