Using Dynamic HTML with Styles

Dynamic HTML works very well with another aspect of Internet Explorer for dynamically changing the formatting of elements in an HTML document: styles and style sheets. Two properties associated with all HTML elements—which, as you will recall, you can access through the all collection—are that element's style and className. The style property, in turn, has properties of its own that you can access and change to immediately change the appearance of the Web page. The className property enables you to access and change many style attributes at once by assigning the elements style class.

Listing 25.4 shows an example of dynamically changing the style of elements of an HTML document. In this example, the format is applied ...

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.