Essentials of Javascript - Cultural View

Essentials of Javascript - Cultural View Essentials of Javascript - Cultural View

culturalview.com
from culturalview.com More from this publisher
14.07.2013 Views

JavaScript Style Sheets 43 JavaScript Style Sheets Filename extension .js Internet media type text/javascript Developed by Netscape Communications Corporation Type of format Style sheet language Standard(s) Netscape's JavaScript-Based Style Sheets submission to the W3C [1] JavaScript Style Sheets (JSSS) was a stylesheet language technology proposed by Netscape Communications Corporation in 1996 to provide facilities for defining the presentation of webpages. [2] It was an alternative to the Cascading Style Sheets (CSS) technology. [2] Although Netscape submitted it to the World Wide Web Consortium (W3C), the technology was never accepted as a formal standard and it never gained much acceptance in the market. Only Netscape Communicator 4 supported JSSS, with the rival Internet Explorer web browser 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 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 many Web developers not even being aware of its existence. The proposed standard was not finished. Using JavaScript code as a stylesheet, JSSS styles individual element by modifying properties of the document.tags object. For example, the CSS: h1 { font-size: 20pt; } is equivalent to the JSSS: document.tags.H1.fontSize = "20pt"; Note the case significance in element names. JSSS is in some ways more powerful and in some ways less powerful than CSS. It lacks the various CSS selector features, supporting only a simple tag name selector. 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 with CSS by using JavaScript to modify the stylesheets applicable to the document at runtime.) Because of this JSSS was often used in the creation of DHTML. Being written in JavaScript, JSSS may seem less friendly than CSS to users without a programming background. Example The following example shows part of the sourcecode of an HTML-document: tags.H1.color = "blue"; tags.p.fontSize = "14pt"; with(tags.H3) color = "green"; with(tags.H2) { color = "red";

JavaScript Style Sheets 44 } fontSize = "16pt"; marginTop = "2cm"; Similar to Cascading Style Sheets JSSS can 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 (4.0–4.8) but no later versions. No other web browser integrated JSSS. External links • Netscape's JavaScript-Based Style Sheets submission to the W3C [1] • The dynamic, powerful abilities of JavaScript Style Sheets [3] References [1] http://www.w3.org/Submission/1996/1/WD-jsss-960822 [2] Håkon Wium Lie; Bert Bos. "Chapter 20 - The CSS saga" (http://www.w3.org/Style/LieBos2e/history/). World Wide Web Consortium. . Retrieved 23 June 2010. [3] http://sunsite.uakom.sk/sunworldonline/swol-04-1997/swol-04-webmaster.html JavaScript engine A JavaScript engine is specialized software which interprets and executes JavaScript. Although there are several [1] [2] uses for a JavaScript engine, the most common usage is for web browsers. History Before the second browser wars in 2008-2009, the JavaScript engine (also known as JavaScript interpreter or JavaScript implementation) was known simply as an interpreter that reads JavaScript source code and executes the script accordingly. The first ever JavaScript engine was created by Brendan Eich at Netscape Communications Corporation, for the Netscape Navigator web browser. The engine, code named SpiderMonkey, is implemented in C. It has since been updated (in JavaScript 1.5) to conform to ECMA-262 Edition 3. The Rhino engine, created primarily by Norris Boyd (also at Netscape) is a JavaScript implementation in Java. Like SpiderMonkey, Rhino is ECMA-262 Edition 3 compliant. Applications of the technology include Apple Safari 4's Nitro, Google Chrome's V8 and Mozilla Firefox 3.5's TraceMonkey. By far, the most common host environment for JavaScript is a web browser. Web browsers typically use the public API to create "host objects" responsible for reflecting the DOM into JavaScript. The web server is another common application of the engine. A JavaScript webserver would expose host objects representing a HTTP request and response objects, which a JavaScript program could then manipulate to dynamically generate web pages. Microsoft's ASP technology for IIS allows server-side code to be written in VB Script or JScript (Microsoft's implementation of JavaScript). Jaxer is a web server that runs entirely on JavaScript. This has the benefit of allowing the same code to be shared on the server and on the client.

JavaScript Style Sheets 43<br />

JavaScript Style Sheets<br />

Filename extension .js<br />

Internet media<br />

type<br />

text/javascript<br />

Developed by Netscape Communications Corporation<br />

Type <strong>of</strong> format Style sheet language<br />

Standard(s) Netscape's JavaScript-Based Style Sheets submission to the W3C [1]<br />

JavaScript Style Sheets (JSSS) was a stylesheet language technology proposed by Netscape Communications<br />

Corporation in 1996 to provide facilities for defining the presentation <strong>of</strong> webpages. [2] It was an alternative to the<br />

Cascading Style Sheets (CSS) technology. [2] Although Netscape submitted it to the World Wide Web Consortium<br />

(W3C), the technology was never accepted as a formal standard and it never gained much acceptance in the market.<br />

Only Netscape Communicator 4 supported JSSS, with the rival Internet Explorer web browser choosing not to<br />

implement the technology. Soon after Netscape Communicator's release in 1997, Netscape stopped promoting JSSS,<br />

instead focusing on the rival CSS standard, which was also supported by Internet Explorer and had much wider<br />

industry acceptance. The follow-up to Netscape Communicator, Netscape 6 (released in 2000), dropped support for<br />

JSSS. It now remains little more than a historical footnote, with many Web developers not even being aware <strong>of</strong> its<br />

existence. The proposed standard was not finished.<br />

Using JavaScript code as a stylesheet, JSSS styles individual element by modifying properties <strong>of</strong> the document.tags<br />

object. For example, the CSS:<br />

h1 { font-size: 20pt; }<br />

is equivalent to the JSSS:<br />

document.tags.H1.fontSize = "20pt";<br />

Note the case significance in element names.<br />

JSSS is in some ways more powerful and in some ways less powerful than CSS. It lacks the various CSS selector<br />

features, supporting only a simple tag name selector. On the other hand, since it is written using a complete<br />

programming language, stylesheets can include highly complex dynamic calculations and conditional processing. (In<br />

practice, however, this can be achieved with CSS by using JavaScript to modify the stylesheets applicable to the<br />

document at runtime.) Because <strong>of</strong> this JSSS was <strong>of</strong>ten used in the creation <strong>of</strong> DHTML.<br />

Being written in JavaScript, JSSS may seem less friendly than CSS to users without a programming background.<br />

Example<br />

The following example shows part <strong>of</strong> the sourcecode <strong>of</strong> an HTML-document:<br />

<br />

tags.H1.color = "blue";<br />

tags.p.fontSize = "14pt";<br />

with(tags.H3)<br />

color = "green";<br />

with(tags.H2)<br />

{<br />

color = "red";

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!