Defined as a technology

Dynamic HTML can be viewed as an evolutionary improvement in browsers, rather than an entirely new, alien technology.

JavaScript commands like

window.alert('Frivolous
Text')
provide a very simple mechanism for changing that which a browser displays. Such features are provided by a host object (the
window
object in this case) and have been available since the earliest days of JavaScript. As browser versions increased, more host objects became available, and the extent of JavaScript's control over the browser environment grew. With the 4.0 browsers, the host objects available have reached a kind of critical mass, sufficient to allow very detailed control over the elements of a document, especially in the Internet Explorer 4.0 case. Taking advantage of this detailed control—ordinary JavaScript applied to newly exposed document features—is all Dynamic HTML really is. An important aspect of this control is that it happens after the document is fully loaded and rendered into the browser.

Put another way, four technologies contribute to Dynamic HTML:

By the time all the latest enhancements for these technologies are rolled together, compatibility levels between Netscape and Microsoft 4.0 browsers are lower than you might otherwise hope for.

JavaScript

JavaScript itself does not contribute much that is new towards dynamic HTML, other than providing a programming mechanism for the host objects innovated by the other technologies. It is the authority that orders those objects' behavior. One exception in the 4.0 browsers is the method

setInterval()
, which is a very handy alternative to
setTimeout()
. Some Dynamic HTML techniques are repetitious—
setInterval()
allows a piece of script to run periodically.

Styles

The properties that make up styles are the meat and drink of Dynamic HTML. By altering these style properties, the script writer can change the appearance of an HTML document even after it is fully rendered on the screen. Styles may be expressed in a number of ways, but the most common approaches, which are the ones that contribute to Dynamic HTML, are based on these standards:

In addition, there is a CSS2 draft standard now, but it is not implemented in either of the major 4.0 browsers. These standards can be viewed at

http://www.w3c.org
.

Internet Explorer 4.0 has an enhancement to style sheets called filters. Filters may be used for a number of additional effects beyond style sheets' normal capabilities.

HTML

With the advent of HTML 4.0, the

STYLE
,
CLASS
and
ID
tag attributes proliferate widely over most tags. These attributes allow style information to be attached to tags, all accessible from JavaScript. The
<DIV>
and
<SPAN>
tags have new importance because of their ability to associate arbitrary chunks of HTML with a style.

Particular to Netscape 4.0 browsers are the

<LAYER>
and
<ILAYER>
tags. Although these tags have no official future and are made somewhat redundant by the CSS-P draft standard, they do provide a useful host object. Only use
<LAYER>
if you are happy to commit to Navigator 4.0.

DOM - the Document Object Model

The Browser Object Model defines all of the JavaScript host objects in the browser. The Document Object Model describes only those parts of the browser model that depend on the currently displayed HTML document. Because of the widespread adoption and therefore importance of HTML, the object model for HTML is undergoing standardization. DOM is that standard, with level 1 (being part 1) released in draft and implemented in Internet Explorer 4.0 only.

The exposure of the DOM to JavaScript gives access to all the pieces of an HTML document. Apart from allowing style manipulation and so on, this exposure also gives access to the original HTML source text from within JavaScript. Previously, you could only 'View Source' the HTML source interactively.

Consequentially, the DOM allows the content of an HTML document to be changed after the document is loaded. Although the DOM isn't mandatory for Dynamic HTML, the content changing behavior that it enables is the most dynamic aspect possible.

This standard can be viewed at

http://www.w3c.org
.

© 1997 by Wrox Press. All rights reserved.