1 //判断函数行参长度来决定是否需要重写setTimeout,ie8以下为undefined 2 if(window.setTimeout.length == undefined){ 3 var __sto = window.setTimeout; 4 window.setTimeout = function(callback,timeout,param){ 5 var args = Array.prototype.slice.call(arguments,2); 6 __sto(function(){ 7 callback.apply(null,args); 8 },timeout); 9 }; 10 }