Displaying Data from a Form
Listing 12.1 A form that displays data in a pop-up window
Here is a breakdown of how this HTML document and script work:
The <script> section in the document's header defines a function called display that opens a new window (as described in Hour 11) and displays the information from the form.
The <input> tags define the form's three fields: yourname, address, and phone. The last <input> tag defines the Display button, which is set to run the display function.
As usual, you can download the listings for this chapter from this book's Web site: http://www.jsworkshop.com/.
Figure 12.1 shows this form in action. The Display button has been pressed, and the pop-up window shows the results.
Figure 12.1. Displaying data from a form in a pop-up window.