HTML and CSS Reference
In-Depth Information
<link href="styles.js"
rel=stylesheet type=text/JavaScript>
The only real difference between this tag and the one for a CSS external
stylesheet is that the type attribute of the <link> tag is set to text/
JavaScript rather than text/CSS . The referenced file, styles.js , contains
JavaScript statements that define styles and classes that Netscape then
uses to control display of the current document.
Document-level JSS is defined within a <style> tag in the <head> of the
document, just like with CSS. Again, there is only one real difference:
the type attribute of the <style> tag is set to text/JavaScript rather than
text/CSS .
The contents of the <style> tag for JSS are quite different from those for
CSS, however. For example:
<style type=text/JavaScript>
<!--
tags.BODY.marginLeft = "20px";
tags.P.fontWeight = "bold";
// -->
</style>
First, notice that we use the standard JavaScript and HTML comments
to surround our JSS definitions, preventing noncompliant browsers from
processing them as HTML content. Also notice that the syntax of the
style definition is that of JavaScript, where letter case, among other
things, does make a difference.
You associate inline JavaScript-based style rules with a specific tag using
the style attribute, just like with CSS inline styles. The value of the at-
tribute is a list of JSS assignments, separated by semicolons. For ex-
ample:
 
Search WWH ::




Custom Search