Jquery实现定时执行操作setInterval和clearInterval、setTimeout函数
1.setInterval()用法:
var idInt = setInterval(function(){},2000);
2.clearInterval用法:
clearInterval(idInt);
另,通过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 = "欢迎您,User ! 当前在线人数:8.当前时间:" + s; setTimeout("viewInExplorerStatus();", 1000); }
相关推荐
jiangbo0 2019-09-08
Luffyying 2016-05-11
hyv 2016-02-19
逆风飞舞0 2015-12-24
xaoyege 2019-06-27
nmgxzm00 2014-04-28
itSeven 2012-12-18
83500391 2012-04-19
愚盦 2011-12-03
sfkong 2020-08-02
89500297 2020-05-05
delmarks 2020-04-09
gjcxywwx 2019-11-04
前端开发Kingcean 2019-10-22
Magicsoftware 2019-10-19
xuewenke 2012-02-05