大佬教程收集整理的这篇文章主要介绍了jquery – 使用什么而不是Object.keys()?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
$('#FIELD_'+office_id).on('change',function(){ offices = $(this).val(); for(var i=0; i<=Object.keys(southland.address).length;i++){ if(offices == Object.keys(southland.address)[i]){ address = southland.address[offices]Object.keys(southland.address[offices])[0]]; } }@H_262_4@其中southland.address来自外部阵列.这在Chrome,IE10和FF中完美无缺,我能为IE8做些什么吗?
if (!Object.keys) { Object.keys = (function () { var hasOwnProperty = Object.prototype.hasOwnProperty,hasDontEnumbug = !({toString: null}).propertyIsEnumerable('toString'),dontEnums = [ 'toString','toLocaleString','valueOf','hasOwnProperty','isPrototypeOf','propertyIsEnumerable','constructor' ],dontEnumsLength = dontEnums.length; return function (obj) { if (typeof obj !== 'object' && typeof obj !== 'function' || obj === null) throw new TypeError('Object.keys called on non-object'); var result = []; for (var prop in obj) { if (hasOwnProperty.call(obj,prop)) result.push(prop); } if (hasDontEnumbug) { for (var i=0; i < dontEnumsLength; i++) { if (hasOwnProperty.call(obj,dontEnums[i])) result.push(dontEnums[i]); } } return result; }; })(); }@H_262_4@或者这个polyfill(包括其他垫片): @H_262_4@https://github.com/kriskowal/es5-shim/
以上是大佬教程为你收集整理的jquery – 使用什么而不是Object.keys()?全部内容,希望文章能够帮你解决jquery – 使用什么而不是Object.keys()?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。