Note : The StyleSheet object is Internet Explorer 4.0 specific.
Each Style Sheet applied to a document (with a
<STYLE>, or by using the
@import method (see the Style Sheets overview)) is a style sheet and is available through the StyleSheets or Imports collections.
Each StyleSheet object has the following properties:
disabled property directly reflects the value of the
DISABLED attribute in either the
<STYLE> element that declares the StyleSheet object. The
disabled property will also be "false" if the referenced StyleSheet object has no
href property will return (or can set) the URL for the referenced style sheet, if the referenced style sheet was included with a
<LINK> element, returning "null" if it was set with a
<LINK>ed Style Sheet objects, the
href property can be changed, causing a different style sheet to be loaded for the document.
id property directly reflects the referenced Style Sheet objects
ID attribute (if set). The
id property is read-only.
owningElement property returns the
<STYLE> element that defined the referenced Style Sheet object in the document.
For Style Sheets attached to a document by the
@import method, the
parentStyleSheet property will return a reference to the
<STYLE> element that 'imported' them into the document.
readOnly property determines whether or not the
addRule method (see below) can be used on the referenced Style Sheet. Style Sheets that aren't read-only, can have style rules added to them, using the
addRule method described below.
type property reflects the value of the
TYPE attribute used in the
<STYLE> element that defines the Style Sheet. Note that Style Sheets with
TYPE attribute values of anything other than 'text/css' aren't supported in Internet Explorer 4.0.
addImport method can be used to include a new
@imported Style Sheet object into the referenced Style Sheet object. The syntax is:
integer = stylesheet.addImport(url, [index])
where integer (the return value) specifies the index of the new
@imported stylesheet in the Imports collection, url is the URL of the new Style Sheet to import and index (if specified) specifies the position of the new Style Sheet object in the StyleSheets collection. If no index is given, then the new Style Sheet object is appended to the end of the StyleSheets collection.
addRule method can be used to add a new Style Sheet rule to the referenced Style Sheet object. For example:
intNewRule = <StyleSheet>reference.addRule "H1", "font-size:36pt"
would add a new Style for
<H1> element to the Style Sheet object referenced by
addRule method can also take a third argument of
index which specifies where in the Rules collection the new style rule should go. By default, new rules will be appended to the end of the referenced style sheet, but by using the
index property, a rule can be inserted anywhere, which can affect the use of the new rule. For example consider the case where the font-size and color of an element are changed by adding a new rule and an existing rule specifies a colour for that particular element. If the new rule is appended to the end of the Rules collection, then its colour setting will over-ride that of the existing rule. If it's included before the existing rule, then the new font-size will be used, but not the colour - that will be used from the existing style sheet rule.
© 1995-1998, Stephen Le Hunte
|file: /Techref/language/html/ib/Scripting_Reference/sso.htm, 7KB, , updated: 2004/3/1 16:47, local time: 2021/10/17 12:50,
|©2021 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?|
<A HREF="http://www.sxlist.com/techref/language/html/ib/Scripting_Reference/sso.htm"> The StyleSheet object</A>
|Did you find what you needed?|
Welcome to sxlist.com!
& kind contributors
just like you!
Please don't rip/copy
Copies of the site on CD
are available at minimal cost.
Welcome to www.sxlist.com!