O'Reilly logo

HTML & XHTML: The Definitive Guide, 6th Edition by Bill Kennedy, Chuck Musciano

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

JavaScript Stylesheets (Antiquated)

Much of a browser's work is manipulating the display, and much of its display code already has been exposed for JavaScripting. So it seemed only natural, perhaps even relatively easy, for the developers at Netscape to implement JavaScript Stylesheets (JSS). Based on the World Wide Web Consortium (W3C)-recommended CSS model, outlined in Chapter 8, this alternative document style technology lets you prescribe display properties for all the various HTML elements, either inline as tag attributes, at the document level, or for an entire document collection.

JSS is antiquated. Even the inventor eschews support for JSS entirely in favor of the standard CSS2. We are strong proponents of reasonable standards, and now that the CSS2 model is fully supported in HTML 4 and XHTML, we can't recommend that you use anything but CSS-standard stylesheets.

We thoroughly discuss the concepts and ideas behind stylesheets—specifically, Cascading Style Sheets—in Chapter 8, so we won't repeat ourselves here. Rather, we address only how to create and manipulate styles with JavaScript here purely for historical reasons. Before forging ahead in this section, we recommend that you first absorb the information in Chapter 8.

JavaScript Stylesheet Syntax

Netscape versions 4 and earlier implemented JSS by extending several existing HTML tags and defining a few objects that store your document's styles. Netscape no longer supports JSS, nor does any other browser.

External, document-level, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required