Chapter 10. Prototype Reference

The Prototype JavaScript framework by Sam Stephenson is designed to ease development of dynamic web applications. It extends core JavaScript classes and adds new ones to provide powerful features, especially for working with Ajax and manipulating DOM elements. In many ways, it also bridges part of the gap between the JavaScript and Ruby languagesparticularly by borrowing ideas from Ruby's Enumerable module.

This chapter is by Sergio Pereira and Scott Raymond. It covers version 1.5.0_rc2.

Prototype can be downloaded from its web site,

This chapter organizes Prototype's functionality into four major sections: Ajax support (wrappers for the XMLHttpRequest object enabling easy two-way communication with remote servers), DOM manipulation (a slew of methods for interacting with page elements), form manipulation (DOM manipulation methods specific to forms and form elements), and core extensions (convenient tools for working with JavaScript data structures, through new classes and extensions of core classes).

All of the code examples in this chapter are JavaScript. But because so much of Prototype is designed to work with HTML and DOM objects, many examples also include some HTML markup at the beginning, formatted as a JavaScript comment:

// <p>Example Paragraph</p>

JavaScript comments are also used to denote the return value of methods. For example:

// => 'result'

Another example:

// <p >One</p> $('one').innerHTML; // => 'One'

Here, the first line indicates a snippet of HTML that will be used in the example, the second line demonstrates a Prototype method, and the third line indicates the value that the method returns.

And now, on with the show.

Ajax on Rails
Ajax on Rails
ISBN: 0596527446
EAN: 2147483647
Year: 2006
Pages: 103
Authors: Scott Raymond

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: