JavaScript Style Sheets


JavaScript Style Sheets was a stylesheet language technology proposed by Netscape Communications in 1996 to provide facilities for defining the presentation of webpages. It was an alternative to the Cascading Style Sheets technology.
Although Netscape submitted it to the World Wide Web Consortium, the technology was never accepted as a formal standard and it never gained acceptance in the web browser market. Only Netscape Communicator 4 implemented JSSS, with rival Internet Explorer choosing not to implement the technology. Soon after Netscape Communicator's release in 1997, Netscape stopped promoting JSSS, instead focusing on the rival CSS standard, which was also supported by Internet Explorer and had a much wider industry acceptance.
The follow-up to Netscape Communicator, Netscape 6, dropped support for JSSS. It now remains little more than a historical footnote, with web developers generally unaware of its previous existence. The proposal did not become a W3C standard.

Syntax

Using JavaScript code as a stylesheet, JSSS styles individual element by modifying properties of a document.tags object. For example, the CSS:

h1

is equivalent to the JSSS:

document.tags.H1.fontSize = "20pt";

JSSS element names are case sensitive.
JSSS lacks the various CSS selector features, supporting only simple tag name, class and id selectors. On the other hand, since it is written using a complete programming language, stylesheets can include highly complex dynamic calculations and conditional processing.
Because of this JSSS was often used in the creation of DHTML.

Example

The following example shows part of the source code of an HTML-document:



Similar to Cascading Style Sheets, JSSS could be used in a tag. This example shows two different methods to select tags.

Browser support

Javascript Style Sheets were only supported by Netscape 4.x but no later versions. No other web browser has ever integrated JSSS.