Chapter 13
Dynamic Contents
The term dynamic contents refers to the ability to access and change a
portion of a document's contents without requiring the downloading or
construction of an entirely new page. A good example is a ticking clock that is automatically updated in the HTML of the document. Once per second, the clock
in the document is updated with a new timewithout having to generate a
new document.
Dynamic HTML provides direct access to the contents of a document,
all the way down to the individual characters. This access enables any portion
of the document to be quickly and immediately updated. Once the document
is updated, surrounding contents may reflow, depending on the size and
position of the new contents. Reflowing the document also often occurs with dynamic styles when the size or display of an element is changed. Dynamic
contents extends this model to changing the text and HTML on the page.
Because the most effective route to understanding how to
dynamically manipulate the document's contents is to review code, this chapter focuses
on code samples to demonstrate the different techniques. The following topics
are covered in this chapter:
- Contents
manipulation This section briefly introduces three
contents manipulation techniques supported by Dynamic HTML.
- Dynamic contents
properties The contents of an element are exposed through four properties and two methods. These
properties provide the easiest and most direct way to access and change
the document's contents. This section discusses how to use the
properties to change an element's contents, as well as how these
properties interact with the document.
- Dynamic contents and
document.write The document.write
method allows contents to be inserted into a page while the page is
being loaded; dynamic contents allows the manipulation of contents
after the page has been loaded. This section explores techniques
for combining these features to create interactive documents.
[Содержание]
|