日期:2014-05-16  浏览次数:20413 次

一段js,求解释
            (function(){
                if (!Function.prototype.bind) {
alert(1);
                    Function.prototype.bind = function(obj){
alert(2);
                        var owner = this, args = Array.prototype.slice.call(arguments), 
              callobj = Array.prototype.shift.call(args);
                        return function(e){
alert(1);
                            e = e || top.window.event || window.event;
                            owner.apply(callobj, args.concat([e]));
                        };
                    };
                }
            })();

------解决方案--------------------
 
(function(){
      if (!Function.prototype.bind) { //判断有没有加过bind属性
          alert(1);
          Function.prototype.bind = function(obj){
              alert(2);
              var owner = this, args = Array.prototype.slice.call(arguments),