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—using = attribute selector


Let's see exactly what attribute selectors can do. In the following HTML markup, you'll see a variety of links. Just pop this into an HTML document and we'll be good to go:

<body>
<p>Go to the <a href="http://mywebsite.com">home page</a>.</p>
<p><a href="http://mywebsite.com/about">This link</a> will not go to the home page.</p>
<p>Please <a href="mailto:[email protected]">email me </a>or <a href="mailto:[email protected]">email Matt</a>.</p>
<p>Download this <a href="foo.zip">ZIP file</a>.</p>
</body>

You should have something like this:

Let's style the first link with MooTools. Its href attribute http://mywebsite.com . Let's say that we want all links in our web page to point to the site's home page, and they will be a green color. We'll use the .setStyle() method to apply the style.

  1. To select all links in a web page that...