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" ...

Get Platinum Edition Using XHTML™, XML, and Java™ 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.