Archive for the 'J2EE' Category

800Part IIIDocument Objects ReferenceReload the (Web design careers) page after you

Saturday, January 12th, 2008

800Part IIIDocument Objects ReferenceReload the page after you are finished to restore the original state. Related Items:addRule(), deleteRule(), insertRule(), removeRule()methods. disabledValue:Boolean.Read/WriteCompatibility:WinIE4+, MacIE4+, NN6+, Moz1+, Safari1+ While the disabledproperty of the styleelement object works with that element only, thestyleSheetobject s disabledproperty works with a styleSheetobject that comes intothe document by a linkelement as well. Enabling and disabling stylesheets is one way to swap different appearance styles for a page, allowing the user to select the preferred style. The page can contain multiple stylesheets thatcontrol the same selectors, but your script can enable one and disable another to change theoverall style. You can even perform this action via the onloadevent handler. For example, ifyou have separate stylesheets for Windows and Mac browsers, you can put both of them inthe document, initially both disabled. An onloadevent handler determines the operating sys- tem and enables the stylesheet tailored for that OS. Unless your stylesheets are very extensive, there is little download performance penalty for having both stylesheets in the document. ExampleUse The Evaluator (Chapter 13) to toggle between the enabled and disabled state of the firststyleSheetobject on the page. Enter the following statement into the top text box: document.styleSheets[0].disabled = (!document.styleSheets[0].disabled) The inclusion of the NOT operator (!) forces the state to change from trueto falseorfalseto truewith each click of the Evaluate button. Related Items:disabledproperty of the styleelement object. hrefValue:String.Read/Write (See Text) Compatibility:WinIE4+, MacIE4+, NN6+, Moz1+, Safari1+ When a stylesheet is linked into a document via a linkelement, the hrefproperty of thestyleSheetobject contains a string with the URL to that file. Essentially, the hrefpropertyof the linkelement is passed along to the styleSheetobject that loads as a result. In WinIE4+ only, this property is read/write, allowing you to dynamically link in an external stylesheet fileafter the page has loaded. In MacIE and NN6+/Moz, this property is read-only. Related Items:linkelement object. idValue:String.Read-OnlyCompatibility:WinIE4+, MacIE4+, NN-, Moz-, Safari- The idproperty of a styleSheetobject inherits the idproperty of its containing element(styleor linkelement). This can get confusing, because it may appear as though two objectsin the document have the same ID. The idstring, however, can be used as an index to thedocument.styleSheetsarray in IE4+ (for example, document.styleSheets[ winLINK ]). NN does not provide a comparable identifier associated with a styleSheetobject. Related Items:idproperty of all element objects. styleSheetObject.cssText
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check mysql web server services.

799Chapter 26Style Sheet and Style ObjectsPropertiescssRulesValue:Array of rule (Web server version)

Friday, January 11th, 2008

799Chapter 26Style Sheet and Style ObjectsPropertiescssRulesValue:Array of rule objects.Read-OnlyCompatibility:WinIE-, MacIE5, NN6+, Moz1+, Safari1+ The cssRulesproperty returns an array of stylesheet rule objects. Strictly speaking, theobjects are called cssRuleobjects in the W3C DOM terminology. This property is implementedin MacIE5, but not in the Windows version as of IE6. The list of rule objects is in source codeorder. The corresponding WinIE4+ property is rules. ExampleUse The Evaluator (Chapter 13) to look at the cssRulesproperty in W3C DOM browsers orMacIE5. First, view how many rules are in the first styleSheetobject of the page by enteringthe following statement into the top text box: document.styleSheets[0].cssRules.lengthNow use the array with an index value to access one of the rule objects to view the ruleobject s properties list. Enter the following statement into the bottom text box: document.styleSheets[0].cssRules[1] You use this syntax to modify the style details of an individual rule belonging to thestyleSheetobject. Related Items:rulesproperty, cssRule, ruleobjects. cssTextValue:String.Read/WriteCompatibility:WinIE5+, MacIE5, NN-, Moz-, Safari- The cssTextproperty contains a string of all stylesheet rules contained by the styleSheetobject. Parsing this text in search of particular strings is not wise because the text returnedby this property can have carriage returns and other formatting that is not obvious from thetext that is assigned to the rules in the stylesheet. But you can use this property as a way tocompletely rewrite the rules of a stylesheet in a rather brute-force manner: Assemble a stringconsisting of all the new rules and assign that string to the cssTextproperty. The more for- mal way of modifying rules (adding and removing them) is perhaps better form, but there isno penalty for using the cssTextproperty if your audience is strictly IE5+. ExampleUse The Evaluator (Chapter 13) to replace the style rules in one blast via the cssTextproperty. Begin by examining the value returned from the property for the initially disabled stylesheetby entering the following statement into the top text box: document.styleSheets[0].cssTextNext, enable the stylesheet so that its rules are applied to the document: document.styleSheets[0].disabled = falseFinally, enter the following statement into the top text box to overwrite the stylesheet withentirely new rules. document.styleSheets[0].cssText = p {color:red} styleSheetObject.cssText
Searching for affordable and reliable webhost to host and run your web applications? Go to our java web server services and you will be pleased.

798Part IIIDocument Objects ReferencestyleSheet ObjectPropertiesMethodsEvent HandlerscssRulesaddImport() cssTextaddRule() disableddeleteRule() (Web design course)

Thursday, January 10th, 2008

798Part IIIDocument Objects ReferencestyleSheet ObjectPropertiesMethodsEvent HandlerscssRulesaddImport() cssTextaddRule() disableddeleteRule() hrefinsertRule() idremoveRule() importsmediaownerNodeownerRuleowningElementpagesparentStyleSheetreadOnlyrulestitletypeSyntaxAccessing styleSheetobject properties and methods: (IE4+/W3C) document.styleSheets[index].property| method([parameters]) Compatibility:WinIE4+, MacIE4+, NN6+, Moz1+, Safari1+ About this objectIf the styleelement object is the concrete incarnation of a stylesheet, then the styleSheetobject is its abstract equivalent. A styleSheetobject exists by virtue of a stylesheet defini- tion being embedded in the current document either by way of the In this example scenario, the document sees just one styleSheetobject. But that object has a stylesheet nested inside the stylesheet defined by the external file. IE4+ calls one ofthese imported stylesheets an importobject. An importobject has all the properties of anystyleSheetobject, but its parentStyleproperty is a reference to the styleSheetthat owns the @importrule. In fact, the @importstatement does not even appear among therules collection of the IE styleSheetobject. Therefore, to access the first rule of theimported stylesheet, the reference is as the following: document.styleSheets[0].imports[0].rules[0] The W3C DOM and NN6+/Moz1+ treat importrule objects differently from the IE model. Tothe W3C DOM, even an at-rule is considered one of the cssRulescollection of a styleSheetobject. One of the properties of a cssRuleobject is type, which conveys an integer code valuerevealing whether the rule is a plain CSS rule or one of several other types, including an importrule. Of course, an imported rule object then has as one of its properties the styleSheetobject that, in turn, contains the rules defined in the external stylesheet file. The parent-childrelationship exists here, as well, whereby the stylesheet that contains the @importrule is ref- erenced by the imported styleSheetobject s parentStyleproperty (just as in IE4+). Reading Style PropertiesBoth the IE4+ and W3C object models exhibit a behavior that at first glance may seem discon- certing. On the one hand, the W3C and good HTML practice encourage defining styles remotely(that is, embedded via