消息:对象不支持此属性或方法 [英] Message: Object doesn't support this property or method

查看:235
本文介绍了消息:对象不支持此属性或方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在IE 8上打开我的网站时出现以下错误,

I am having following error when i open my site on IE 8,

Message: Object doesn't support this property or method
Line: 25
Char: 13
Code: 0
URI: mycode.js

mycode.js文件代码

mycode.js FILE CODE

var LstCompanies = Object.keys(msg);
if (LstCompanies.length > 0) {

任何想法

推荐答案

IE中不支持Object.keys。
这是更安全的实现,它与所有浏览器兼容..

Object.keys doesnt supported in IE. Here is the safer implementation which is compatible with all browsers..

Object.keys = Object.keys || function(o) { 
    var keysArray = []; 
    for(var name in o) { 
        if (o.hasOwnProperty(name)) 
          keysArray.push(name); 
    } 
    return keysArray; 
};

这篇关于消息:对象不支持此属性或方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆