JavaScript Style Sheets
| Company type | Corporation |
|---|---|
| Industry | Software, Internet |
| Founded | 1994 |
| Fate | Discontinued development of JSSS in 1997 |
| Headquarters | United States |
| Products | Netscape Communicator, JavaScript Style Sheets (JSSS) |
JavaScript Style Sheets (JSSS) was a stylesheet language introduced by Netscape Communications Corporation in 1996 as a method for specifying the visual design of web pages. It was intended as an alternative to Cascading Style Sheets (CSS).
Though Netscape submitted JSSS to the World Wide Web Consortium (W3C) for consideration, it never achieved official standardization and did not gain widespread adoption. The only browser to support JSSS was Netscape Communicator version 4; competing browsers such as Internet Explorer never implemented it. Following the release of Netscape Communicator in 1997, Netscape discontinued efforts to promote JSSS and instead concentrated on CSS, which enjoyed broader industry endorsement including from Internet Explorer.
With the launch of Netscape 6 in 2000, support for JSSS was completely removed. Presently, JSSS is regarded as an obsolete technology, largely unfamiliar to contemporary web developers, and it never became a recognized W3C standard.
Syntax
JSSS stylesheets are written using JavaScript by altering properties within the document.tags object. For instance, the CSS declaration:
<syntaxhighlight lang="css">
h1 { font-size: 20pt; }
</syntaxhighlight> corresponds to this JSSS statement: <syntaxhighlight lang="javascript">
document.tags.H1.fontSize = "20pt";
</syntaxhighlight> Note that element identifiers in JSSS are case sensitive.
Unlike CSS, JSSS supports only basic selectors based on tag names, classes, and IDs. However, since it leverages a full programming language, stylesheets can incorporate sophisticated dynamic computations and conditional logic—capabilities advantageous for generating interactive page styles.
Example
A sample HTML document utilizing JSSS might contain:
<syntaxhighlight lang="html"> <style type="text/javascript"> tags.H1.color = "red"; tags.p.fontSize = "20pt";
with (tags.H3) {
color = "green";
} with (tags.H2) {
color = "red"; fontSize = "16pt"; marginTop = "4cm";
} </style> </syntaxhighlight>
Similar to CSS, JSSS code could be included within a <style> element, illustrating various approaches for targeting HTML elements.
Browser support
JSSS was exclusively supported by Netscape versions 4.0 through 4.8; no other browsers implemented this stylesheet language.