setTimeout—JS学习笔记2015-6-19(第61天)

setTimeout(函数,毫秒)

// 执行一次;

clearTimeout();

 

setTimeout( function(){

  miaov.style.display = 'inline-block';   // 初始设定2秒后显示;

  setTimeout(function(){  // 定时器嵌套, 设定3秒后隐藏;

    miaov.style.display = 'none';

},3000);  

},2000)

 

setTimeout 和 setInterval 都是后置型,也就是说,先读到时间数字,然后才是执行前面的代码;

 

事件后面直接跟的是函数名,比如:

qq.onmouseover = show;  // 这里的show是函数名;

 

posted on 2015-06-19 23:18  张小国  阅读(120)  评论(0编辑  收藏  举报

导航