dijit.byId doesn't work on IE8 with dojo.addOn

2019-07-16 04:37发布

When I load this script with IE8, I've got exception Object does not support this property or method. But it works with other browsers.

I use dijit 1.3.1 and I don't understand.

dojo.addOnLoad(init);
var DG;
var datas;

function init(){
    DG = dijit.byId("DG");
}

I've had parseOnload: true but it changes anything.

<script type="text/javascript" src="dojo/dojo.js"
        djConfig="parseOnLoad: true">
</script>

1条回答
叛逆
2楼-- · 2019-07-16 05:38

This migth probably not fix the problem, but the function init() is used before it was declared. Try this:

    var DG;
    var datas;

    function init(){
        DG = dijit.byId("DG");
    }

    dojo.addOnLoad(init);

Does it work?

查看更多
登录 后发表回答