stages = {
"1": {
id: "1",
div: "foo"
},
"2": {
id: "2",
div: "bar"
},
"3": {
id: "3",
div: "foobar"
}
};
當我在Firefox中運行此項時,它很好。但在IE8中運行時,我得到這個錯誤:在IE8中的JavaScript對象錯誤
Message: Object doesn't support this property or method
這是一個已知的bug /有一種解決方法或者是我的語法?
您是否嘗試過用'var'聲明「stages」? – Pointy
不,因爲我希望它成爲全球性的 – jdborg
我在IE8上運行了上述內容,沒有收到錯誤。也許你只需要將關鍵部分(id,div)包裹在「」中? – scrappedcola