Book Image

MooTools 1.2 Beginner's Guide

Book Image

MooTools 1.2 Beginner's Guide

Overview of this book

MooTools is a simple-to-use JavaScript library, ideal for people with basic JavaScript skills who want to elevate their web applications to a superior level. If you're a newcomer to MooTools looking to build dynamic, rich, and user-interactive web site applications this beginner's guide with its easy-to-follow step-by-step instructions is all you need to rapidly get to grips with MooTools.
Table of Contents (14 chapters)
MooTools 1.2 Beginner's Guide
Credits
About the Authors
About the Reviewer
Preface

Creating MooTools classes


I've mentioned it, like, a million times already, but here I go again, MooTools is an object-oriented web application framework. And what's OOP without classes? Not OOP, that's for sure! MooTools is, to me, the only JavaScript library that effectively implements and promotes the use of classes.

What the heck is a class?

A class, in terms of object-oriented programming, is a definition of an object, or an object's blueprint, its design, its structure, its template, I can go on, but I think you get the picture. Classes are best described in real-world terms.

Real-world analogy

Let's say our class is "Dog". A dog can have a lot of traits, such as its name, its type (for example, Golden Retriever or Poodle), its age, and so on. In MooTools, these traits are called options, which is an object that contains default key/value pairs specific to a particular class.

A dog can also do a lot of things, such as bark, sit, or eat. In the context of JavaScript and classes, these are...