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

怎么定时调用啊 谢谢
var a={
total:8,
x:function(){
this.total--;
document.getElementsByTagName("input")[0].value=this.total;
window.setTimeout(this.x(),1000);
},
m:function(){
window.setInterval(,1000);
}
}

------解决方案--------------------
额,例子:

var a={
total:8,
x:function(){
window.setInterval(function(){a.y(a.total);},2000);//定时调用y方法,并传递参数
},
y:function(index){alert(index);}

a.x();