5009:IE8SCRIPT438: 对象不支持“keys”属性或方法,trim的方法,SCRIPT5009: “Set”未定义

这些都是从网上搜集的,解决了Ie8的报错问题

//这个是解决ie8 trim的方法Function.prototype.method = function (name, func) { this.prototype[name] = func; return this;};if (!String.prototype.trim) { //判断下浏览器是否自带有trim()方法 String.method('trim', function () { return this.replace(/^\s+|\s+$/g, ''); }); String.method('ltrim', function () { return this.replace(/^\s+/g, ''); }); String.method('rtrim', function () { return this.replace(/\s+$/g, ''); });}

解决的链接文章

//解决ie8:对象不支持“keys”属性或方法if (!Object.keys) { Object.keys = (function () { var hasOwnProperty = Object.prototype.hasOwnProperty, hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'), dontEnums = [ 'toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable&#

相关推荐

相关文章