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

Chapter 1. Why Use Prototype and Scriptaculous?

If you've ever written cross-browser JavaScript then you'll know how poorly JavaScript interfaces on different browsers are matched. Prototype takes a lot of these headaches away, leaving a consistent, standards-compliant API that is compatible with multiple browsers. It supports tasks including:

  • Event handling and observation

  • DOM manipulation

  • String processing

  • Event observation

  • Form processing

  • Asyncronous JavaScript and XML (Ajax)

In addition, it provides generally useful facilities around loops, array processing and higher-order combining forms that allow code to be glued together in more powerful ways.

Scriptaculous takes this one step further, adding. It adds controls, composable effects, and drag-and-drop, making it easier to use JavaScript for more complex tasks and richer user interfaces.

Prototype and Scriptaculous do not bring anything new to JavaScript; they simply make it quicker, easier, and less complex. In this section we will discuss a few areas where using Prototype and Scriptaculous drastically simplifies code.

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