Chapter 5. Making Content Dynamic

In addition to letting you script the positions of elements, as described in Chapter 4, Dynamic HTML is meant to allow you to write scripts that modify content and adjust styles on the fly. Prior to the Version 4 browsers, your ability to script dynamic content was limited to controlling the HTML being written to the current page, loading HTML documents into other frames, and, in some browser versions, swapping images during mouse rollovers. The Version 4 browsers offer much more in the way of altering the content and appearance of documents that have already been displayed in response to user activity.

Unfortunately for those of us on the leading edge of DHTML deployment, Navigator 4 and Internet Explorer 4 have very different ideas about how content should be made dynamic. In particular, IE 4 exposes much more of every document element to scripting, and the browser automatically reflows a document to accommodate any changes you make. Navigator 4’s capabilities are more limited in this regard. Notably, Navigator’s lack of automatic reflow puts the browser at a disadvantage if your design calls for dynamically changing inline elements of a page.

This chapter provides an overview of the most common ways of dynamically changing content, including some that date back to Navigator 2. It also offers some suggestions about how to develop workarounds for the widely divergent approaches to dynamic content practiced in the two Version 4 browsers.

Writing Variable ...

Get Dynamic HTML: The Definitive Reference 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.