0

CSWING引用jsFiddle的[code][1],为什么会提示“TypeError: this.domNode is null (26 out of range 15) in dojo.js”。

这是我从 CSWING 复制的代码,用于学习和测试,

<!DOCTYPE html>
<html>
 <head>
  <style>
    html, body /*standard layout for every dojo webpage*/
  {
    width: 100%;
    height: 100%;
    padding: 0px;
    margin: 5px;
    overflow: hidden;/*no scrollbar used*/
  }

#standby {
    position: absolute;
    top: 50%;
    left: 50%;
    width:32px;
    height:32px;
    margin-top: -16px;
    margin-left: -16px;
   /*
    width: 300px;
    height: 300px;
    background-color: #e7e7e7;
   */
}

</style>
<link rel="stylesheet" href="../dojo1_8/dijit/themes/claro/claro.css">
<script>dojoConfig = {parseOnLoad: true}</script>
<script src="../dojo1_8/dojo/dojo.js"></script>

</head>
<body class="claro">
<div id="standby">    
<div id="btn" data-dojo-type="dijit.form.Button" data-dojo-props="label:     
Go'"></div>    
</div>

<script>
require(["dojox/widget/Standby","dijit/form/Button",
"dojo/store/Memory",'dijit/form/ComboBox',
"dojo/on", "dojo/domReady!"],
function(Standby, Button, Memory, on, ComboBox)
{       
    var standby = new Standby
    ({
           id: "standbyObj",
       target: "btn",
        color: "transparent",
       zindex: "auto",
     duration: "1000"
    });
dojo.body().appendChild(standby.domNode);
standby.startup();

on(dojo.byId('btn'), 'click', function() 
{
    standby.show();

  //simulate a request.  hide the timeout in 5 seconds
 setTimeout(function()
{
    standby.hide(); 
    }, 5000);
   });
   });
   </script>
   </body>
</html>

请指教。感谢克莱门特 [1]:http: //jsfiddle.net/cswing/253Te/

4

1 回答 1

1

看着我原来的小提琴,我相信

dojo.byId('btn')

应该

dijit.byId('btn')

如果那不能解决您的问题,那么我会将 firebug 设置为 Break on Errors。发生错误时,请查看堆栈跟踪以查找有关错误来自何处以及可能导致错误的原因的更多信息。

于 2013-07-12T12:01:00.730 回答