1NetMedia_Blog

<< 过滤数组中重复的元素  类别: ASP/.NET QQ邮件群发避开反垃圾邮件机制的... >>
asp阻断循环间隔执行某段程序
[ 日期: 2013-09-05 4:11:17 PM | 作者: admin | 来源: 网络收集 | 人气:1629 | 晴天 | 心情: +2 ] 字号: 【
急速栏目链接:
标签:阻断循环  |  间隔执行  |  
<%
Const CUTTime = 5
for i=0 to 10
Response.write("<body style='font-size:9pt'>正常执行中..<br>下面调用阻断,挂起流程" & CUTTime & "秒<br><br>")
Response.Flush
CUT
Response.write("<br>正常执行中..</body>")
Response.Flush
next

Sub CUT()
Dim NOWTime
NOWTime = Now()
Response.write("<font color=blue>调用阻断,挂起流程.当前时间:" & NOWTime & "</font><br>")
Response.Flush
Do While Datediff("s",NOWTime,Now()) < CUTTime
'阻断循环
Loop
Response.write("<font color=green>销毁阻断,恢复流程.当前时间:" & NOW() & "</font><br>")
Response.Flush
End Sub
%>


对照JS的setInterval方法


<%dim total:total=10%>
<script type='text/javascript' src='http://code.jquery.com/jquery-latest.js'></script>


<div id="txt"></div>
<script language="javascript">
//设置全局变量
var staticObj = {};
staticObj.timer = "";
staticObj.count = 0;

staticObj.timer = setInterval(function(){reloadData(staticObj.count+"s")},500);


function reloadData(ty){
  staticObj.count++;
  
  $("#txt").html("Interval循环次数:" + staticObj.count+"=="+ty);
  if(staticObj.count == <%=total%>){
   clearInterval(staticObj.timer);
   $("#txt").html("Interval循环已经结束!");
  }
}

</script>

   
Rss Comment  

没有相关评论

发表评论
请先注册,才能发表评论!
- 注册 -