Reputation: 11228
I have this super simple code in index.html
<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>
I get error Error: Could not load 'dojo.fx'; last tried './fx.js'
Note: I hadn't changed dojo's directory structure. I'm using dojo 1.6
-dojo
-dijit
-dojox
-labs
-ex01
-index.html
Upvotes: 3
Views: 1305
Reputation: 11228
The problem was dojo simply won't run from my local filesystem.
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.).
Upvotes: 2
Reputation: 183
Your code works perfectly fine. I have setup a jsFiddle with Dojo 1.6 here: http://jsfiddle.net/6h82P/
Here's a complete example:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/dojo/1.6.0/dojo/dojo.xd.js.uncompressed.js'> </script>
</head>
<body>
<div id="greeting">Hello</div>
<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>
</body>
</html>
Upvotes: 0