JavaScript Style Sheets
This article needs additional citations for verification. (November 2023) |
| JavaScript Style Sheets | |
|---|---|
| Internet media type |
text/javascript |
| Developed by | Netscape Communications Corporation |
| Type of format | Style sheet language |
| Standard | Netscape's JavaScript-Based Style Sheets submission to the W3C |
JavaScript Style Sheets (JSSS) is an obsolete stylesheet language technology proposed by Netscape Communications in 1996 to provide facilities for defining the presentation of webpages.[1] It was an alternative to the Cascading Style Sheets (CSS) technology.[1]
Although Netscape submitted it to the World Wide Web Consortium (W3C), 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 (released in 2000), 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 { font-size: 20pt; }
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. (In practice, however, this can be achieved using JavaScript to modify the stylesheets applicable to the document at runtime.) Because of this JSSS was often used in the creation of dynamic web pages.
Example
The following example shows part of the source code of an HTML document:
<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>
Similar to Cascading Style Sheets, JSSS could be used in a <style> tag. This example shows two different methods to select tags.
Browser support
Javascript Style Sheets were only supported by Netscape 4.x (4.0–4.8) but no later versions. No other web browser has ever implemented JSSS.
References
- ^ a b Håkon Wium Lie; Bert Bos. "Chapter 20 - The CSS saga". World Wide Web Consortium. Retrieved 23 June 2010.
External links
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.