一、setTimeout() 延迟性操作

 window.setTimeout(function(){
console.log('派大星');//延迟了4秒
},4000);
console.log('海绵宝宝'); //定时器 异步运行
function hello(){
alert("hello");
} var t1 = window.setTimeout(hello,1000);//使用方法名字执行方法
var t2 = window.setTimeout("hello()",3000);//使用字符串执行方法

二、setInterval() 定时输出

 var num = 0;
var timer = null;
timer = setInterval(function(){
num++;
if(num>5){
clearInterval(timer);
return;
}
console.log('num:'+num);
},1000);//1秒输出一次 //实时刷新 时间单位为毫秒
setInterval('refreshQuery()',8000);
/* 刷新查询 */
function refreshQuery(){
console.log('每8秒调一次')
}

最新文章

  1. Oracle统计函数之Lead
  2. IT软件开发常用英语词汇
  3. 10 Ways to Inspire Your Team
  4. 顺序表(C++)
  5. Swift结构体与类
  6. Git Github jekyll,gem Liquid模板语言 Markdown
  7. TCP 滑动窗口
  8. JavaScript关于js垃圾回收
  9. 安装VC6.0安装步骤及心得体会
  10. mysql登录报错:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
  11. linux驱动工程面试必问知识点
  12. dubbo配置方式简单介绍
  13. c++中虚析构函数
  14. learning at command AT+CSQ
  15. js android页面被挂起问题解决
  16. PHP的extension_dir设置问题
  17. 字符串化#、拼接字符##和可变参数宏(...和_ _VA_ARGS_ _)
  18. day0201
  19. 本地测试ajax遇到的跨域问题
  20. c# 如何制作RealPlayer 视频播放器

热门文章

  1. 获取浏览器视口高度device-width
  2. javascript树形汇总金额
  3. FlowPortal:流程节点定义有误,合流节点"合流"没有对应的聚焦节点
  4. 无法Google的解决方案
  5. web端百度地图API实现实时轨迹动态展现
  6. Unity Ruby's Adventure 第一步
  7. MariaDB主从复制和读写分离
  8. 理解OAuth2
  9. Jmeter工具使用初体验
  10. CSS transition 的默认值