2015-05-04 67 views
3

我试图通过IE jQuery对象错误SCRIPT5007

items.push(new Item(1, [0, 40], 'asd'); 

然后访问JQuery的对象变量

var items = []; 
function Item(id, position, content) { 
    this.id = id; 
    this.position = position; 
    this.content = content; 
} 

我创建一个新元素i和通过阵列中的所有项目循环,当调用

item[i].position[0] 

我收到错误SCRIPT5007。在Chrome和FF这工作正常,唯一的问题是与IE。

+0

你在你的循环中放置了一个调试器行吗?这应该会给你更多的信息。 – Mouser

+0

你是通过'http://'还是'file://'打开页面? –

+0

请问您能否添加IE11报告的“SCRIPT5007”的描述? – gaetanoM

回答

0

header

<meta http-equiv="X-UA-Compatible" content="IE=edge" > 

它将工作添加此行!

+0

相信我我已经尝试过。 – Hene

+0

哪个IE版??? –

+0

IE 11.0.9600.17728(KB3038314) – Hene

0

我在我的本地系统上试过了。他们是2个错误:

  1. 已知的缺失)

items.push(new Item(1, [0, 40], 'asd');

items.push(new Item(1, [0, 40], 'asd'));

  • 您呼吁错误的var名称
  • item[0].position[0]

    items[0].position[0]

    localy尝试过了,它工作正常!