Start your free trial now, and begin learning software, business and creative skills—anytime, anywhere—with video instruction from recognized industry experts.

Start Your Free Trial Now

Writing a Prototype-enabled page

Writing a Prototype-enabled page provides you with in-depth training on Developer. Taught by Joe Mar… Show More

Prototype and Essential Training

with Joe Marini

Video: Writing a Prototype-enabled page

Writing a Prototype-enabled page provides you with in-depth training on Developer. Taught by Joe Marini as part of the Prototype and Essential Training
Expand all | Collapse all
  1. 2m 26s
    1. Welcome
      1m 19s
    2. Using the exercise files
      1m 7s
  2. 18m 4s
    1. Introducing Prototype
      4m 59s
    2. Downloading and installing Prototype
      4m 53s
    3. Writing a Prototype-enabled page
      5m 44s
    4. Exploring Prototype's features
      2m 28s
  3. 38m 9s
    1. Overview of Prototype content functions
      4m 42s
    2. Looking up elements with $()
      5m 14s
    3. Using the $$() selector function
      12m 32s
    4. Retrieving form element values with $F()
      8m 38s
    5. Getting practical: Annotating page links
      7m 3s
  4. 1h 6m
    1. Introducing the extensions
      2m 41s
    2. Using objects
      10m 54s
    3. Using strings
      15m 32s
    4. Using numbers
      7m 17s
    5. Using arrays
      7m 19s
    6. Using Prototype templates
      8m 9s
    7. Performing periodic tasks with PeriodicalExecuter
      7m 41s
    8. Using JSON support
      6m 51s
  5. 48m 2s
    1. Understanding the collection features
      2m 55s
    2. Working with the Enumerable class
      24m 51s
    3. Creating arrays with $A()
      3m 58s
    4. Handling ranges with $R()
      2m 46s
    5. Making Hash objects with $H()
      13m 32s
  6. 1h 2m
    1. Understanding Prototype's element class
      9m 0s
    2. Manipulating content
      6m 21s
    3. Traversing the DOM
      14m 24s
    4. Changing CSS and element visibility
      5m 53s
    5. Setting element positioning
      12m 38s
    6. Using other DOM element functions
      2m 32s
    7. Getting practical: The automatic table of contents generator
      11m 26s
  7. 41m 2s
    1. Understanding the Prototype event class
      5m 6s
    2. Observing events
      11m 45s
    3. Getting information about events
      8m 28s
    4. Creating custom events
      8m 43s
    5. Getting practical: Table striping and highlighting
      7m 0s
  8. 25m 59s
    1. Creating and handling AJAX requests
      12m 25s
    2. Using the Ajax.Updater
      8m 40s
    3. Handling periodic updates
      4m 54s
  9. 25m 36s
    1. Introducing
      4m 37s
    2. Using visual effects
      7m 7s
    3. Using drag and drop
      4m 47s
    4. Using autocomplete
      5m 23s
    5. Using sliders
      3m 42s
  10. 54m 10s
    1. Getting started
      4m 50s
    2. Displaying information dynamically
      14m 32s
    3. Filtering data
      19m 32s
    4. Building an image rotator
      15m 16s
  11. 19s
    1. Goodbye

please wait ...
Writing a Prototype-enabled page
Video Duration: 5m 44s 6h 21m Beginner


Writing a Prototype-enabled page provides you with in-depth training on Developer. Taught by Joe Marini as part of the Prototype and Essential Training

View Course Description

In Prototype and Essential Training, Joe Marini introduces the concepts and techniques for using Prototype and, two of the most popular open-source JavaScript libraries for building cross-browser, highly interactive, and visually appealing web sites. This course also covers installing each of the libraries and explaining their unique purposes, using simple CSS3 expressions to manipulate web content, working with events in a cross-browser way, and enhancing a real-world web site example to show different ways that the libraries can be used. Exercise files are included with the course.

Topics include:
  • Retrieving and manipulating web page elements
  • Extending JavaScript objects, strings, numbers and more
  • Handling web page events and creating custom events
  • Traversing the DOM
  • Creating and handling AJAX requests
  • Using controls such as Autocompleters, Sliders, and Visual Effects
  • Building complex page features like data filtering and image rotators
Developer Web
Ajax Prototype

Writing a Prototype-enabled page

Let's just jump right in and build our first Prototype enabled web page. So before we do that, a quick word about tools. For the remainder of this course, I'm going to be using a tool named Aptana Studio. And Aptana Studio is a really good cross-platform IDE for working with web content like HTML and JavaScript files. And it's freely available from The reason I chose to use it is because it's cross-platform, so if you're following me along on a Mac or Windows, it doesn't really matter.

You can just download it to your computer free of charge and follow along with me. Now, since Prototype and are just JavaScript files and we'll be working with HTML, you can use whatever IDE you are happy and familiar with. I just want to let you know that I'm going to be using Aptana. So you can download it here from the website. You just click Download Now. You can see that it's available for various different platforms, whether standalone, or if you already have Eclipse installed, and you can get it for Windows, Mac, or Linux.

So that's the tool that I'm going to be using. Now, I've already installed it, so I'm going to go ahead and switch over to it. So this is Aptana Studio. And this is the tool that I'm going to be using for the examples. So I'm going to go ahead and open up our example file. So I'm going to open up the file. Now, if you have the exercise files, you'll see that in the exercise_files folder, I have arranged all of the examples according to chapters. And here in the first chapter for the overview, I've got two examples, the FirstPrototype Start and Finished.

Now, the Finished file is the completed example. And you can go ahead and jump forward to that if you just want to see how everything works, or you can follow along with me and we can work together on the Start version. So I'm going to open up the Start. And you can see that this is a pretty plain HTML page. So to use Prototype in our web page, I just have to include it using a script tag. So I'm going to insert a script and let's say type equals text/javascript.

And now I need to point the source attribute to the location where the prototype.js file is kept. Now, I've put it at the root level of the exercise_files folder. That way it can be accessed by all of the examples using a relative URL format. So I'm just going to type "../". And you can see that there it is right there, the prototype.js file. So I'll double click that and close the tag. And that's pretty much all there's to it. Now our prototype is embedded in the page. And we can Save.

All right. So now let's just do a quick simple example to show how Prototype works. So I'm going to enter another script tag, type equals, once again, text/javascript. So I'll put our example code in here. What I'm going to do is show an example of how to fire off a script when the page loads. And ordinarily, you would do this by doing something like body and then you'd probably do something like onload equals function.

The problem with this approach is that the onload event on the body tag only fires once all of the body's content has finished downloading, and that includes images. So if you have a bunch of images in your page or a lot of content, then this event isn't going to fire until-- It could be sometime before all the content downloads, and in the meantime, your user is trying to interact with the page and nothing is happening. Well, prototype fixes that problem by making available a cross-browser event called dom:loaded, which fires much, much sooner than the body's onload event.

The way that works is you observe the document event for the dom:loaded. Now, I'm not going to expect that you understand everything that I'm about to type right away, but we will cover all of this in subsequent lessons. Just for the moment, follow along with me as I explain what's going on here. So what I need to do is write document. observe, and this is how in Prototype you register for event handlers. You type the name of the element, in this case document, and then the observe function is what observes events.

So the event I'm interested in observing is the dom:loaded event. And then I need to provide a function that's going to run when the dom gets loaded. So I'm just going to put in an anonymous function right here. And I'm going to write just a simple alert that says "The page has loaded! You're using Prototype!" So that's all there is to it.

That's our first Prototype-enabled page. So let's jump over to the browsers and see if it works. I'm going to go to the exercise_ files folder. Here's the folder. So I'm just going to double-click on this guy and that should bring up Firefox. And you can see that when Firefox loads, we get our alert. So let's make sure that this is running properly cross-browser. I'll bring up IE next. Okay. So here I am in the examples. I'm going to right-click. I'm going to choose Open with Internet Explorer.

And you can see I get the same result. So we have a cross-browser way now of detecting when the page has loaded. And that's our first example using Prototype.

There are currently no FAQs about Prototype and Essential Training.






Don't show this message again
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.

Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ .

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now Already a member? Log in

* Estimated file size

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.

Mark all as unwatched Cancel


You have completed Prototype and Essential Training.

Return to your organization's learning portal to continue training, or close this page.


Upgrade to View Courses Offline


With our new Desktop App, Annual Premium Members can download courses for Internet-free viewing.

Upgrade Now

After upgrading, download Desktop App Here.

Become a Member and Create Custom Playlists

Join today and get unlimited access to the entire library of online learning video courses—and create as many playlists as you like.

Get started

Already a member?

Log in

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

You started this assessment previously and didn’t complete it.

You can pick up where you left off, or start over.

Resume Start over

Learn more, save more. Upgrade today!

Get our Annual Premium Membership at our best savings yet.

Upgrade to our Annual Premium Membership today and get even more value from your subscription:

“In a way, I feel like you are rooting for me. Like you are really invested in my experience, and want me to get as much out of these courses as possible this is the best place to start on your journey to learning new material.”— Nadine H.

Thanks for signing up.

We’ll send you a confirmation email shortly.

Sign up and receive emails about and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from

Sign up and receive emails about and our online training library:

Here’s our privacy policy with more details about how we handle your information.

submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.