<script language="javascript">
/**//*
??? 功能:修改 window.setTimeout,使之可以传递参数和对象参数
??? 使用方法: setTimeout(回调函数,时间,参数1,,参数n)
*/
var mySetTimeOut = setTimeout;
window.setTimeout = function(callback, timeout)
{
var args = Array.prototype.slice.call(arguments, 2);
function callFn(){callback.apply(null, args);}
return mySetTimeOut(callFn, timeout);
}
///测试代码
function aaaa(a)
{
??? alert(a);
??? window.setTimeout(aaaa,1000,a);
}
function aaaaa(a,b,c)
{
??? alert(a + b + c);
}
var a = new Object();
window.setTimeout(aaaa,1000,a);
window.setTimeout(aaaaa,2000,a,6,7);
</script>