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);