Introducing prototype.js
Tutorial Details:
Prototype is a JavaScript framework by Sam Stephenson designed to help make developing dynamic web apps a whole lot easier. In basic terms, it’s a JavaScript file which you link into your page that then enables you to do cool stuff.
Knocking up a basic example
So to get this show on the road, there are three files we need to set up in our site alongside prototype.js. Obviously we need a basic HTML page with prototype.js linked in. This is the page the user interacts with. Secondly, we need our own JavaScript file for the glue between the interface and the stuff Prototype is doing. Lastly, we need the page (a PHP script in my case) that the Ajax is going to make its call too.
So, to that basic HTML page for the user to interact with. Here’s one I found whilst out carol singing:
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
Easy Ajax
As you can see, I’ve linked in prototype.js, and also a file called ajax.js, which is where we’ll be putting our glue. (Careful where you leave your glue, kids.)
Our basic example is just going to take a name and then echo it back in the form of a seasonal greeting. There’s a form with an input field for a name, and crucially a DIV (greeting) for the result of our call. You’ll also notice that the form has a submit button – this is so that it can function as a regular form when no JavaScript is available. It’s important not to get carried away and forget the basics of accessibility.
Read
Tutorial at: Click here to view the tutorial
Rate Tutorial: Easy Ajax with Prototype
View Tutorial: Easy Ajax with Prototype
Related
Tutorials:
Automating WWW
Exploration
Automating WWW
Exploration |
GNU offers a new kind of Java IDE - JavaWorld - July 1998
GNU offers a new kind of Java IDE - JavaWorld - July 1998 |
The state of Java application middleware,
Part 1 - JavaWorld March 1999
The state of Java application middleware,
Part 1 - JavaWorld March 1999 |
Behold the power
of parametric
polymorphism - JavaWorld February
2000
Behold the power
of parametric
polymorphism - JavaWorld February
2000 |
Become a programming Picasso with JHotDraw -
JavaWorld
February 2001
Become a programming Picasso with JHotDraw -
JavaWorld
February 2001 |
The basics of Java class loaders
The basics of Java class loaders |
Step into
the J2EE architecture and process
Step into
the J2EE architecture and process |
Integrate Java and C++ with Jace
Integrate Java and C++ with Jace |
Design patterns make for
better J2EE apps
Design patterns make for
better J2EE apps |
Java Tip 130: Do you
know your data
size?
Java Tip 130: Do you
know your data
size? |
Check out three
collections libraries
Check out three
collections libraries |
Java Tip 134: When
catching exceptions, don't cast your net too wide
Java Tip 134: When
catching exceptions, don't cast your net too wide |
The first taste of Liberty
The first taste of Liberty |
TimCam
TimCam is an easy-to-use webcam program written in (pure) Java. It was designed to mimic such fantastic projects as ConquerCam, but with an added bonus: TimCam is in the public domain. |
Introduction to JavaServer Faces
This article is meant to acquaint the reader with JavaServer Faces, commonly known as JSF. JSF technology simplifies building the user interface for web applications. It does this by providing a higher-level framework for working with your web app, repres |
Prototyping Desktop Applications
Prototyping Desktop Applications
a prototype can be used to gather user feedback very early in the development process. The prototype can also help you to estimate the time and resources needed to complete your project. It takes a lot of work to build a |
Hermes JMS Browser
Hermes JMS Browser
Hermes is a Swing application that allows you to interact with JMS providers.
|
Data Models for Desktop Apps
Data Models for Desktop Apps
This is the third article in a series that presents the prototype of a Java desktop application called JImaging. The first article described the three major Java GUI toolkits: AWT, Swing, and SWT. In the second article, I int |
JTimepiece
JTimepiece is the advanced library for working with dates and times in Java. Many easy-to-use methods in this API make it easy for any developer, from beginner to expert, to use JTimepiece. |
ORA
ORA is a Framework written in Java (plattform independent). |
|
|
|