Jquery实现定时执行操作setInterval和clearInterval、setTimeout函数
2013-02-01 09:47
417 查看
1.setInterval()用法:
var idInt = setInterval(function(){},2000);
2.clearInterval用法:
clearInterval(idInt);
以上两个方法结合使用,可以实现实时执行某些功能,并每次执行间隔时间也可以设置。Demo如:
http://blog.csdn.net/majian_1987/article/details/8561855
另,通过setTImeOut()也可以设置定时操作,具体demo如下:
var idInt = setInterval(function(){},2000);
2.clearInterval用法:
clearInterval(idInt);
以上两个方法结合使用,可以实现实时执行某些功能,并每次执行间隔时间也可以设置。Demo如:
http://blog.csdn.net/majian_1987/article/details/8561855
另,通过setTImeOut()也可以设置定时操作,具体demo如下:
function viewInExplorerStatus() { var date = new Date(); s = date.getYear() + "年" + (date.getMonth()+1) + "月" + date.getDate() + "日" + date.getHours() + "点" + date.getMinutes() + "分" + date.getSeconds() + "秒"; if (!Flag) { s = ""; } window.status = " 欢迎您,test ! 当前在线人数:8. 当前时间:" + s; setTimeout("viewInExplorerStatus();", 1000); }
相关文章推荐
- Jquery中使用setInterval和setTimeout 实现定时执行函数
- .net全局定时定期执行某些操作在Global.asax中具体实现
- .net全局定时定期执行某些操作在Global.asax中具体实现
- c#多线程实现定时执行代码与lock锁操作
- javascript中定时执行的方法setinterval()和settimeout()和clearinterval()
- .net全局定时定期执行某些操作在Global.asax中具体实现
- LINUX定时执行SHELL脚本实现DB2数据库操作,crontab无法正常识别执行
- jquery实现触发、失去焦点操作并执行ajax操作
- .net全局定时定期执行某些操作在Global.asax中具体实现
- .net全局定时定期执行某些操作在Global.asax中具体实现
- 在ORACLE中实现后台自动执行的定时操作
- 在Android开发中,定时执行任务的3种实现方法:
- jquery+ajax+C#实现无刷新操作数据库数据
- jquery操作select实现根据拼音动态获取姓名列表
- jQuery实现两个select控件的互移操作
- quartz实现每周一至周五 非法定节假日 每天9:30-11:30,13:00-15:00执行定时任务
- jquery.cookie.js操作cookie实现“记住密码”,很简单很强大
- React中实现定时操作和时间间隔内循环操作
- 使用MyBatis对表执行CRUD操作——基于XML的实现