O'Reilly logo

Prototype and Scriptaculous: Taking the Pain out of JavaScript by Chris Angus

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

4.1. Getting Started

The Scriptaculous distribution is available from http://script.aculo.us/downloads.

Figure 4-1. Scriptaculous downloads page

The file scriptaculous-js-x.x.x.zip (at the time of writing: scriptaculous-js-1.6.2.zip) should be saved and unpacked to a convenient location.

The distribution contains a lib directory containing the file prototype.js and a src directory containing the following Scriptaculous files:

  • scriptaculous.js

  • builder.js

  • effects.js

  • dragdrop.js

  • controls.js

  • slider.js

  • unittest.js

These files (including prototype.js) should be copied to a convenient location (the file unittest,js is optional).

NOTE

The version of Prototype may differ from the version of Prototype you already have. If this is the case, the later version of Prototype should be used. At the time of writing, Scriptaculous 1.6.2 uses Prototype-1.5.1rc0, while the latest released version of Prototype is 1.4.0. In this case, if we want to use Scriptaculous, we should use prototype-1.5.1rc0 as prototype.js throughout.

Using Scriptaculous involves making the script in prototype.js and scriptaculous.js visible to your own JavaScript. This is usually done via the script tag, specifying the URLs of prototype.js and scriptaculous.js in that order.

<script src=prototypeURL content="text/javascript"></script>
<script src=scriptaculousURL content="text/javascript"></script>

The following ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required