Function.prototype's apply and call were only added in ECMA262 Edition3 released in 1999 (ECMA262 Edition2 was released in 1998). In previous browsers such as IE5.01 (JScript 5.0), there is no apply and call. Therefore, there will be some compatibility issues. Here are the fixes:
if(!Function.prototype.apply){
Function.prototype.apply = function(obj, args){
obj = obj == undefined ? window : Object(obj);//obj can be js basic type
var i = 0, ary = [], str;
if(args){
ary[i ] = "args[" i "]"; ;
try{
return eval(str);
}catch(e){
}finally{
delete obj._apply;
}
};
}
if(!Function.prototype.call){
Function.prototype.call = function(obj){
var i = 1, args = [];
for( len=arguments. length; i args[i-1] = arguments[i];