MooTools 1.2 Beginner's Guide
上QQ阅读APP看书,第一时间看更新

Time for action—giving our class instance some custom options

Let's give some custom options to our class by deploying the following:

  1. Go back to the source code of the HTML document you just created. Go to the var myDog = new Dog({ }); line.
  2. Pass property values to name, type, and age like so:
    var myDog = new Dog({
    name : 'Zensis',
    type : 'German Sheperd',
    age : 10
    });
    
  3. Open your HTML document in the web browser, and now, you should see something like this:
    Time for action—giving our class instance some custom options