2015-05-04 66 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嘗試過了,它工作正常!