Changing HTML Documents On-the-Fly

Listing 25.7 shows two ways HTML elements can be changed on-the-fly. The digital clock (see Figure 25.11) is an HTML element, but it changes automatically each second to reflect the local time. The paragraph following it, on the other hand, is changed in response to user input—when the user clicks the Change HTML button, the contents of the text box above the button are substituted for the paragraph. As you can see in Figure 25.12, this substitution can also include any HTML elements, as shown with the hypertext links in this example.

Figure 25.11. Real-time clocks appearing in Web pages are common; with Dynamic HTML, however, you can make them appear using only HTML elements.
Figure 25.12. Dynamic HTML can ...

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.