<script>
delete Function.prototype.call;
delete Function.prototype.apply;
Function.prototype.apply = function (obj, argu) {
var s;
if (obj) {
obj.constructor.prototype._caller = this;
s = "obj._caller";
} else {
s = "this";
}
var argus = new Array();
if(!argu)
return eval(s+"()");
for (var i=0;i<argu.length;i++)
argus[i] = "argu[" + i + "]";
eval("var r = " + s + "(" + argus.join(",") + ");");
return r;
}
Function.prototype.call = function (obj) {
var argu = new Array();
for (var i=1;i<arguments.length;i++)
argu[i-1] = arguments[i];
return this.apply(obj, argu);
}
function a(p,q,m){alert(p+q+m);}
Function.prototype.call.apply(a,[null,1,2,3]);
</script>
posted on 2007-04-28 15:32
汪杰 阅读(354)
评论(1) 编辑 收藏 引用 所属分类:
javascript