dijit.byId返回未定义

| 这很奇怪,我在dojo.addOnLoad(function {...})中调用dijit.byId(),它返回未定义的。为了检查id是否存在,我同时调用dojo.byId(),它返回一些对象。所以我猜该组件不是dijit组件?这是整个代码:请帮助我,谢谢建议!
<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">
<html>
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">
<title></title>

<!-- Dojo/Diji definations -->
<link href=\'../dojoroot/dijit/themes/tundra/tundra.css\' type=\'text/css\' rel=\'stylesheet\'/>
<link href=\'../dojoroot/dojo/resources/dojo.css\' type=\'text/css\' rel=\'stylesheet\'/>

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


<!-- Main scripts -->

<script type=\"text/javascript\">
    dojo.addOnLoad(function()
    {
        // Include library
        dojo.require(\"dijit.layout.BorderContainer\");
        dojo.require(\"dijit.layout.TabContainer\");
        dojo.require(\"dijit.layout.ContentPane\");

        // add the select child event to the tab panel
        alert(dijit.byId(\"contentTabPanel\"));  // return no defined
        alert(dojo.byId(\"contentTabPanel\")); // return an object

    });
</script>
</head>

<body class=\"tundra\">
<div dojoType=\"dijit.layout.BorderContainer\" style=\"width: 100%; height: 100%;\">
    <!-- Content Tab Panel -->
    <div id=\"contentTabPanel\" dojoType=\"dijit.layout.TabContainer\" region=\"center\">
        <!-- Tab UserGroup -->
        <div dojoType=\"dijit.layout.ContentPane\" title=\"UserGroup\">
        </div>
    </div>
</div>
</body>
</html>
OMFG !!!!!我知道原因!!!!我为这个愚蠢的错误花费了5个小时: 我必须写
    // Include library
    dojo.require(\"dijit.layout.BorderContainer\");
    dojo.require(\"dijit.layout.TabContainer\");
    dojo.require(\"dijit.layout.ContentPane\");
在dojo.addOnLoad(function(){之外!     
已邀请:

要回复问题请先登录注册