DHTML in Fourth-Generation Browsers
Internet Explorer 4 and Netscape 4 were the browsers that introduced DHTML technology to the Internet. Both browsers include partial support for the CSS1 standard and support the CSS positioning attributes (which were integrated into the CSS2 standard) that are critical to DHTML. Unfortunately, the DOM standard did not exist when these fourth-generation browsers were being developed, so they do not conform to that standard. Nevertheless, it is possible to achieve DHTML effects in both browsers.
DHTML in Internet Explorer 4
As we saw in Chapter 17,
IE 4 does not support the document.getElementById( )
method, nor does it support an API for dynamically
creating new nodes and inserting them into a document. Instead, it
provides the document.all[]
array as a way of
locating arbitrary elements of the document and allows document
content to be altered with the innerHTML
property
of document elements. IE 4 does not conform to the standards here,
but it provides adequate alternatives.
Although traversing and modifying documents is an important part of
DHTML, the focus of this chapter is on the dynamic use of CSS styles.
The good news is that the DOM API described earlier for setting CSS
style attributes through the style
property was
adopted from the IE 4 API. Thus, once you’ve used
document.all[]
to locate the document element you want to modify, you can script the styles of that element just as you would in a browser that fully supports the DOM API. ...
Get JavaScript: The Definitive Guide, Fourth Edition 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.