O'Reilly logo

Platinum Edition Using XHTML™, XML, and Java™ 2 by Andrew H. Watt, Mike Morgan, Jim O'Donnell, Eric Ladd

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

XHTML Form Text Field Validation and Formatting with JavaScript

Listing 21.1 is an example of a traditional XHTML page used to gather input from a user. Take a closer look at a few of the elements of this page.

Code Listing 21.1. Form.htm—An XHTML Document Using a Standard XHTML Form
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Forms Verification</title> </head> <body bgcolor="#ffffff"> <h1>Credit Card Payment Information</h1> <hr /> <b>All information must be entered before the form can be submitted…</b> <form name="MyForm"> <table> <tr><td>First name:</td> <td>&nbsp</td> <td><input type="text" name="FirstName" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required