日期:2014-05-16  浏览次数:20310 次

js如何在对象中使用定时器
function temperature() //对象
{
this.times=0;//定时器对象
this.change=function()
{
this.times++;
alert(this.times);
if(this.times==5)
{
clearInterval(times);
}

}
this.callback=function()
{
var te=this;
times=setInterval(function(){te.change();},1000);
}
}