Style controls can be effected from JavaScript code.

The style mechanisms allow the content and the appearance of the document to be separated. The style sheet can now define the appearance of the page. This also means that styles can be shared and if your server is up to the task, you can serve a different style sheet according to the user agent value defined by the requesting browser.

Currently, CSS1 styling is widely used and CSS2 is gaining acceptance.

As far as we are concerned with JavaScript, we either need to create a style or apply it to part of a document. To create a style in Netscape Navigator 4 we use JSSS (JavaScript Style Sheets), which is functionally equivalent to CSS1. However JSSS is completely unavailable in any other browser, including Netscape Navigator 6.0 and its use for scripts is discouraged.

See also:.htc, <META>, <STYLE TYPE="...">, CSS, CSS level 1, CSS level 2, Document.attachEvent(), Document.detachEvent(), JavaScript Style Sheets, Window.attachEvent(), Window.detachEvent()


Wrox Instant JavaScript - page 50