It seems that I installed Scriptaculous incorrectly, but I canβt understand what happened. Here is an example to show the problem:
<html> <body> <script src="js/prototype.js" type="text/javascript"></script> <script src="js/scriptaculous.js" type="text/javascript"></script> <p id="hello">Hello, World!</p> <a href="javascript:void(0)" onclick="Effect.Shrink('hello');">Shrink effect</a> <a href="javascript:void(0)" onclick="$('hello').shrink();">Shrink method</a> </body> </html>
When I click on the "Compression Effect" link, I get a Javascript error: "Effect not defined." When I click on the "Shrink method" link, I get another error: "$ (" hello "). Shrink is not a function."
The problem disappears if I explicitly refer to the effects of the script:
<html> <body> <script src="js/prototype.js" type="text/javascript"></script> <script src="js/scriptaculous.js" type="text/javascript"></script> <script src="js/effects.js" type="text/javascript"></script> <p id="hello">Hello, World!</p> <a href="javascript:void(0)" onclick="Effect.Shrink('hello');">Shrink effect</a> <a href="javascript:void(0)" onclick="$('hello').shrink();">Shrink method</a> </body> </html>
This workaround is acceptable, but can't Scriptaculous load all its helper scripts automatically? Installation instructions seem to say what it should be.
My html file and js folder are not in the root folder of the web server, they are both under the application folder. I see the same behavior in Firefox 3.5.7 and Internet Explorer 8.0.
source share