Java Reference
In-Depth Information
was any other value, like text/plain , then responseJSON would be null , and you would have to use
responseText in conjunction with JSON.parse() , like this:
var response = JSON.parse(transport.responseText);
The final two lines of code in this example register the click event listeners on the two <a/> elements:
$("usernameAvailability").observe("click", checkUsername);
$("emailAvailability").observe("click", checkEmail);
You retrieve the elements using Prototype's $() function, and then you use observe() to register the
event listeners.
Prototype is a powerful framework that provides a rich set of utilities to change the way you write
JavaScript. But a simple section such as this is far too small to cover the framework adequately.
For further information on Prototype and the utility it offers, see the API documentation at
http://api.prototypejs.org/ an d the tutorials at http://prototypejs.org/learn/ .
delving into mootools
At first glance, MooTools looks identical to Prototype, and rightly so. MooTools was first developed
to work with Prototype, so you shouldn't be surprised to see some striking similarities between the
two.
However, MooTools is more of a cross between jQuery and Prototype as far as DOM manipulation
is concerned. Like Prototype, MooTools' goal is to augment the way you write JavaScript, providing
tools to write classes and inherit from them. Also like Prototype, MooTools adds in a rich set
of extensions to make DOM manipulation easier, and you'll find that selecting DOM objects in
MooTools is exactly the same as Prototype. But as you'll see in the following sections, the extension
method names and the way in which you use them is reminiscent of jQuery.
getting mootools
You can download MooTools in two ways: You can download the core, or you can customize your
own build. The MooTools' core contains everything you need to perform common DOM and Ajax
operations, but if you don't need the full power of core, you can pick and choose which pieces you
need for your page or application.
Regardless of the version you want, you can download both at http://mootools.net/core/builder .
Additionally, you can choose to download the compressed or uncompressed JavaScript file. The code
download includes the compressed core of version 1.5.1.
testing Your mootools' installation
As we mentioned earlier, many similarities exist between MooTools and Prototype; so, testing your
MooTools' installation will look very similar to the Prototype test.
 
Search WWH ::




Custom Search