![]() |
New JSSS Methods and Property![]() ![]() ![]() ![]() ![]()
In addition to the three new objects, the world of JSSS offers a new method to help set contextual styles and a new property useful for assigning conditional styles.
Conditional styles are applied depending on the status of other variables, whether it's other style or the value on a form. For example, you could check for the existence of color combinations that are hard to read (such as red on blue) and change the colors to more palatable choices. The contextual methods enables you to specify styles based on their relation to the position of other tags. Its purpose is the same as the contextual syntax for CSS. You can set all <P> tags under and <H1 > tag to a 14 point typeface and all <P> tags under an <H2> tag to a 1 2 point typeface. This use is applied based on the paragraph's context to the heading tags, not on classes. The preceding example is represented like this: <style type= "text/javascript "> con textual (tags. h 1, tags.p) fontSize = " 14pt"; </style> We didn't use document in the styleclefinitions. Why not? Because document is one of the top level documents for a Web page, it is understood. You can use it for clarity, but it's not required. The apply property is used as shorthand to set the style of a tag or group of styles using a function. For example, consider the following function, which sets a background color for an unspecified tag based on the value of its color. function setBackground (thisTag) with (thisTag) { if (color) == "yellow") { else backgroundcolor = "blue"; backgroundcolor "black"; Hl.color = "white";
H2. color = "yellow "; H3.color= "purple"; tags. H 1. apply = setBackground (tags. H 1); tags. H2. apply setBackground (tags. H2); tags. H3.apply setBackground (tags. H3); This code snippet first sets the color of three heading s tags. Then, it takes each of the tags and applies the rules set forth in the function. In this JSSS definition, the text color is set first, then the background is changed using the setBackground method with the apply property. Listing: <HTML> function setBackground(thisTag){ backgroundColor = "blue";
if (color == "white"){ backgroundColor = "black"; with (tags) { H3. color = "purple"; <H3> This is purple on the default background color </H3>
|
|
Domain NamesDHTML Document Object Model Features of Dynamic HTML HTML Versus DHTML Netscape's Vision of DHTML Microsoft Vision of DHTML Cascading Style Sheets(CSS) Inline Style Sheets Embedded Style for a Page Linked Cascading Style Sheet Text Specific Style AttributesCSS Attributes Assigning Classes Java Script Style Sheets(JSSS) Object Property Functions Methods
Creating Style Sheets with JSSS New JSSS Methods Working Layers Positioning the Layer Using More than One Layer Moving a Layer Around on the Page Events
The mouseOver and mouseOut Events The mouseMove Event The Keyboard Events The mouseDown and mouseUp Events The dragDrop Event Error Event Form Event The Script Tag Changing Text Color Inline Text Attribute Changes Text Dynamically Changing StylesExample of Dynamically Changing Style Dynamically Changing Content HTML Replacement Changing Text Content An Example of HTML Graphics ReplacementWeb DesignWeb HostingE Commerce |
| Home | Web Hosting | Web Design | Sitemap |
| Copyright (C) 2007. Web Domain design hosting. All rights reserved. |