• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 25. Advanced Microsoft Dynamic HTML > Using Dynamic HTML with Styles

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 to two elements in different ways—either through an embedded style sheet created with the <style> element or through the style attribute. No matter which way you do it, the script changes the format in response to the onmousedown and onmouseup events. Figures 25.5 and 25.6 show the before and after screen shots of this HTML document.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint