Specifications

The Dreamweaver JavaScript API 403
CSS Styles functions
CSS styles functions handle the application, removal, creation, and deletion of CSS styles.
Methods of the
dreamweaver.cssStylePalette object either control or act on the selection in
the CSS Styles panel, not in the current document.
dom.applyCSSStyle()
Availability
Dreamweaver 4
Description
Applies the specified style to the specified element. This function is valid only for the active
document.
Arguments
elementNode, styleName, [classOrID], [bForceNesting]
elementNode is an element node in the DOM. If elementNode is NULL or an empty string
(
’’), the function acts on the current selection.
styleName is the name of a CSS style.
[classOrID] is the attribute with which the style should be applied (either "class" or "id").
If elementNode is NULL or an empty string and no tag exactly surrounds the selection, the style
is applied using
SPAN tags. If the selection is an insertion point, Dreamweaver uses heuristics to
determine to which tag the style should be applied.
[bForceNesting] is a Boolean value, which indicates whether nesting is allowed. If the
bForceNesting flag is specified, Dreamweaver inserts a new SPAN tag instead of trying to
modify the existing tags in the document. This argument defaults to false if it is not
specified.
Returns
Nothing.
Example
The following code applies the red style to the selection, either by surrounding the selection with
SPAN tags or by applying a CLASS attribute to the tag that surrounds the selection:
var theDOM = dreamweaver.getDocumentDOM(’document’);
theDOM.applyCSSStyle(’’,’red’);
dom.removeCSSStyle()
Availability
Dreamweaver 3
Description
Removes the CLASS or ID attribute from the specified element, or removes the SPAN tag that
completely surrounds the specified element. This function is valid only for the active document.