首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

js怎么在对象中使用定时器

2012-11-22 
js如何在对象中使用定时器function temperature() //对象{ this.times0//定时器对象this.changefunctio

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

热点排行
Bad Request.