bind的IE678的兼容写法

来源:互联网 发布:淘宝生意参谋 编辑:程序博客网 时间:2024/05/17 00:52

注意:必须写在最前面。

if(!-[1,]){        Function.prototype.bind=function (oThis) {            var objbind = this;            //将arguments变成数组            var arg = [].slice.call(arguments,1);            return function () {                fn.apply(oThis,arg);            }        }    }    box.onclick= fn.bind(wrap,1,2);    function fn(a,b,e) {        e = e || window.event;        alert(this.nodeName)    }
原创粉丝点击