javascript - 错误 : Could not load module in dojo

标签 javascript dojo

我在 index.html 中有这个 super 简单的代码

<script src="../../dojo/dojo.js"></script>
<script>
    dojo.require("dojo.fx");
    dojo.ready(function(){
        dojo.byId("greeting").innerHTML += ", from " + dojo.version;
        dojo.fx.slideTo({
            top: 100,
            left: 200,
            node: dojo.byId("greeting")
        }).play();
    });
</script>

我收到错误 错误:无法加载“dojo.fx”;最后尝试 './fx.js'

注意:我没有更改 dojo 的目录结构。我正在使用 dojo 1.6

-dojo
-dijit
-dojox
-labs
 -ex01
  -index.html

最佳答案

问题是 dojo 根本无法从我的本地文件系统运行。

Run your source code from a web server, not the file system, even if the web server is running on your development machine. The browser's handling of HTTP requests from the local file system are more restrictive than from a web server, even when it's running in the same machine. For consistent results, you should always run Dojo from within any HTTP web server (Apache, nginx, Tomcat, IIS, Jetty, etc.).

关于javascript - 错误 : Could not load module in dojo,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14079549/

相关文章:

javascript - 在 Dojo 请求错误时访问 http body

javascript - 如何重用和覆盖继承的javascript函数

javascript - Dojo Dijit 样式问题

javascript - dojo.query 获取必填字段

javascript - 使用 Firebase 的数据库样式查询

javascript - 默认选择第一个单选按钮

javascript - jquery 数据表 - 为 select.className 应用值未按预期工作

javascript - 如何在小部件上设置 HTML5 事件?

javascript - 我怎样才能找出哪些事件附加到 HTML 元素?

javascript - 使用 xlsx/sheetjs 添加动态列