开发者

Javascript object erroring in IE8

    stages = {
            "1": {
                id: "1",
                div: "foo"
            },
            "2": {
                id: "2",
                div: "bar"
            },
            "3": {
                id: "3",
                div: "foobar"
            }
        };

When I run this in Firefox, it's fine. But when r开发者_运维技巧un in IE8, I get this error:

Message: Object doesn't support this property or method

Is this a known bug / is there a workaround or is it my syntax?


If there is an element with id=stages in your markup, some browsers create global variable stages as a reference to it. However, IE doesn't support overriding it without declaring it. If you want stages variable to be global, put var stages; to global scope or assign the object to window.stages.


I don't get that error at all. I can define that very code in a javascript file or in the console and it works just fine.

I do see that error if I try and run the code from jsfiddle.net. However the error is referring to code in Action.js and the following code

if (e && e.target.getParent().get('id') == 'm') {

It appears to be unhappy with e.target.

How exactly are you causing that error to popup?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜