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

Time for action—determining the value of our options


The following steps help us to determine the value of our options:

  1. Right below where we use the .bark() method on myDog, type in the following code:

    document.write( 'My dog\'s name is ' + myDog.options.name + '.<br />');
    document.write( 'My dog is a ' + myDog.options.type + '.<br />');
    document.write( 'My dog is ' + myDog.options.age + ' years old.<br />');
    
  2. Open up your HTML document on the web browser, and after you exit out of the dialog box that .bark() calls, you should see something like this:

Extending classes

Oftentimes, you'll want to extend a class with another class. For example, we might want to extend our Dog class with a class for show dogs that may use the same options, but may do other special things.

We can extend classes with the Extends property. Extends is a property specifically for classes, that not only inherits properties and methods from a parent class, it makes all parent methods available inside...