新手道场 - Google CDN 问题
我有一个测试jsp:
<head>
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js" type="text/javascript">
</script>
<script type="text/javascript">
dojo.require("dojo.widget.Tree");
dojo.require("dojo.widget.TreeSelector");
dojo.require("dojo.widget.TreeNode");
dojo.require("dojo.widget.TreeContextMenu");
</script>
</head>
<body>
<div dojoType="TreeSelector" widgetId="treeSelector"></div>
<div dojoType="Tree" widgetId="treeWidget" selector="treeSelector"toggler="wipe">
<div dojoType="TreeNode" widgetId="1" title="First node" isFolder="false"></div>
<div dojoType="TreeNode" widgetId="2" title="Second node">
<div dojoType="TreeNode" widgetId="2.1" title="Second node First Child"></div>
<div dojoType="TreeNode" widgetId="2.2" title="Second node Second Child"></div>
</div>
<div dojoType="TreeNode" widgetId="3" title="Third node" isFolder="false"></div>
</div>
这在任何浏览器中都不起作用。 我认为这很容易,似乎 dojo 库没有被下载/找到? 我还需要做其他事情吗?
另外,我的 IDE JDeveloper 报告元素 div 上未定义属性“dojoType”。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我不得不说,这个示例看起来像是取自 非常 的 dojo 版本,但您正尝试在 Dojo 1.5 上运行它。这很可能行不通。
dojo.widget
从...0.4 开始就不存在了,也许是 0.9 以后。您对前面的答案的评论可能是正确的,因为在原始示例中不需要
parseOnLoad: true
,但我也向您保证,该示例没有在附近运行任何版本的 Dojo你用什么来运行它。根据您在那里看到的内容,您可能想从这里开始: http://www.dojotoolkit.org/reference-guide/dijit/Tree.html
I have to say, this example looks like it is taken from a very old version of dojo, but you're trying to run it against Dojo 1.5. That most likely won't work.
dojo.widget
hasn't existed since...0.4, 0.9 maybe.You may be right in your comment to the previous answer in that no
parseOnLoad: true
was necessary in the original example, but I'd also assure you that that example was not running any version of Dojo anywhere near what you're running it with.Based on what you're looking at there, you may want to start somewhere like here: http://www.dojotoolkit.org/reference-guide/dijit/Tree.html
我不确定它不存在时的默认行为是什么,但您可能需要定义一个 djConfig 并将 parseOnLoad 设置为 true (或直接调用解析器)。有关详细信息,请参阅以下链接:
http://docs.dojocampus.org/djConfig
http://dojocampus.org/content/2008/03/08/the-dojo-解析器/
I'm not sure what the default behavior is when it's not present, but you probably need to define a djConfig with parseOnLoad set to true (or call the parser directly). See the following links for more information:
http://docs.dojocampus.org/djConfig
http://dojocampus.org/content/2008/03/08/the-dojo-parser/
请遵循:
您需要:
google.load
,则需要使用 onload 回调推迟代码的执行。就我个人而言,我会做类似的事情:
在 my.html 的
部分中:
in my.js< /em>:
Follow the:
You need to:
google.load
, you need to defer the execution of your code using an onload callback.Personally, I would just do something like:
within the
<head>
section of my.html:in my.js: