jq定时器

1.
$(function(){
  setInterval (showTime, 2000);
  function showTime(){
  var today = new Date();
  alert("The time is: " + today.toString ());
}
})
2.
$(function(){
  $.extend({
    showTime:function(){
      alert(
"The time is: " + today.toString ());

    } 
    setInterval($.
showTime,3000); 
  })
})

3.清除定时器

//把定时器赋值给一个变量
var int=setInterval(function(){}, timer);
//清除定时器
clearInterval(int);
 
posted @ 2018-08-22 09:50  就是你baby  阅读(5367)  评论(0编辑  收藏  举报