作家
登录

JavaScript实现Sleep函数的代码

作者: 来源:www.28hudong.com 2013-03-30 03:41:23 阅读 我要评论

复制代码 代码如下:function Sleep(obj,iMinSecond) { if (window.eventList==null) window.eventList=new Array(); var ind=-1; for (var i=0;i<window.eventList.length;i++) { if (window.eventList[i]==null) { window.eventList[i]=obj; ind=i; break; } } if (ind==-1) { ind=window.eventList.length; window.eventList[ind]=obj; } setTimeout("GoOn(" + ind + ")",iMinSecond); } function GoOn(ind) { var obj=window.eventList[ind]; window.eventList[ind]=null; if (obj.NextStep) obj.NextStep(); else obj(); } function Test() { alert("sleep"); Sleep(this,100); this.NextStep=function() { alert("continue"); } }

  推荐阅读

  一个不错的应用,用于提交获取文章内容,不推荐用

复制代码 代码如下:<script language="javascript"> function showlist(vtype) { with (document.listform) { w_type.value=vtype; } document.listform.subm>>>详细阅读


本文标题:JavaScript实现Sleep函数的代码

地址:http://www.17bianji.com/kaifa2/JS/30860.html

关键词: 探索发现

乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

网友点评
自媒体专栏

评论

热度

精彩导读
栏目ID=71的表不存在(操作类型=0)