一般,写首页轮播模块时都须要用到间歇调用函数的调用与清除,因为setInterval定时 器存在一些性能上的问题,所以,在实际开发中都采用setTimeout来模拟setInterval的 功能,其模拟代码以下: var timer = setTimeout(function() { //doing something setTimeout(arguments.callee, interval) }, interval); 因为在timer 内部调用其自身,因此致使clearTimeout(timer)失效,对于这个问题,只需 要稍作修改便可解决,其代码以下: var timer = setTimeout(function() { //doing something timer = setTimeout(arguments.callee, interval) }, interval); 这样,便可经过clearTimeout(timer)清除setTimeout模拟的setInterval间歇调用程 序; 备注:若有更好的方法,各位网友能够写在评论区,本人感激涕零。