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—loading HTML data


We're going to give the user the option to load data from other HTML files. This gives us the ability to provide them with requested data on demand.

  1. Start by creating two HTML documents that will serve as our remote HTML data. Save them as htmlremote1.html and htmlremote2.html. Place some sample HTML markup to help you determine which file is being loaded. Here is what I used for htmlremote1.html:

    <p>This is data from <strong>htmlremote1.html</strong></p>
    
  2. Next, create a new HTML document that will be our web page that loads the two HTML documents. Name it anything you like, but save it in the same location as the two other HTML files.

  3. In our HTML document, we will add two<a> elements that will serve as means for the user to request the data they want. We also create a div element with an ID of load-area that will contain the HTML that we retrieve.

    <a id="load-htmlremote1" href="#">Load content from htmlremote1.html</a...