< Day Day Up > |
CSS functions handle applying, removing, creating, and deleting CSS styles. Methods of the dreamweaver.cssRuleTracker object either control or act on the selection in the CSS rule tracker panel of the Selection inspector. Methods of the dreamweaver.cssStylePalette object either control or act on the selection in the Styles panel, not in the current document. cssStylePalette.getInternetExplorerRendering()Availability Dreamweaver 8. Description This function determines whether Dreamweaver is rendering for Internet Explorer. Arguments None. Returns A Boolean value: true if Dreamweaver is rendering for Internet Explorer; false if Dreamweaver is rendering to the CSS specification. Example The following example turns off rendering for Internet Explorer: if (cssStylePalette.getInternetExplorerRendering()){ cssStylePalette.setInternetExplorerRendering(false); } cssStylePalette.setInternetExplorerRendering()Availability Dreamweaver 8. Description This function instructs Dreamweaver to render for Internet Explorer or the CSS specification. Arguments internetExplorerRendering
Returns Nothing. Example See "cssStylePalette.getInternetExplorerRendering()" on page 923. 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}
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.getElementView()Availability Dreamweaver 8. Description This function gets the Element view for the currently selected element in the document. If the currently selected element is normal, the getElementView() function looks for the selected element's first ancestor that is either full or hidden. Arguments None. Returns A string that indicates the status of the selected element. Values include:
Example The following example changes the status of the selected element to "full" if it is "hidden": var currentDOM = dw.getDocumentDOM(); if (currentDOM && getElementView() == "hidden"){ currentDOM.setElementView("full"); } dom.getShowDivBackgrounds()Availability Dreamweaver 8. Description This function gets the state of the Layout Block Backgrounds visual aid. Arguments None. Returns A Boolean; true if the Layout Block Backgrounds visual aid is on; false otherwise. Example The following example checks whether the Layout Block Backgrounds visual aid is on and, if not, turns it on: var currentDOM = dw.getDocumentDOM(); if (currentDOM.getShowDivBackgrounds() == false){ currentDOM.setShowDivBackgrounds(true); } dom.getShowDivBoxModel()Availability Dreamweaver 8. Description This function gets the state of the Layout Block Box Model visual aid. Arguments None. Returns A Boolean; true if the Layout Block Box Model visual aid is on; false otherwise. Example The following example checks whether the Layout Block Box Model visual aid is on and, if not, turns it on: var currentDOM = dw.getDocumentDOM(); if (currentDOM.getShowDivBoxModel() == false){ currentDOM.setShowDivBoxModel(true); } dom.getShowDivOutlines()Availability Dreamweaver 8. Description This function gets the state of the Layout Block Outlines visual aid. Arguments None. Returns A Boolean; true if the Layout Block Outlines visual aid is on; false otherwise. Example The following example checks whether the Layout Block Outlines visual aid is on and, if not, turns it on: var currentDOM = dw.getDocumentDOM(); if (currentDOM.getShowDivOutlines() == false){ currentDOM.setShowDivOutlines(true); } 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. Arguments elementNode, {classOrID}
Returns Nothing. dom.resetAllElementViews()Availability Dreamweaver 8. Description This function resets the Element view of all elements in the document to the original view by removing all internally generated CSS. Arguments forceRefresh
Returns Nothing. Example The following example resets the Element view of all elements in the document without forcing a refresh of the rendering: var currentDOM = dw.getDocumentDOM(); currentDOM.resetAllElementViews(false); dom.setElementView()Availability Dreamweaver 8. Description This function sets the Element view for the currently selected element in the document. If the currently selected element is "normal", the setElementView() function looks for the first ancestor of the currently selected element that is "full" or "hidden". Arguments view
Returns Nothing. Example See "dom.getElementView()" on page 925. dom.setShowDivBackgrounds()Availability Dreamweaver 8. Description This function turns the Layout Block Backgrounds visual aid on or off. Arguments show
Returns Nothing. Example See "dom.getShowDivBackgrounds()" on page 926. dom.setShowDivBoxModel()Availability Dreamweaver 8. Description This function turns the Layout Block Box Model visual aid on or off. Arguments show
Returns Nothing. Example See "dom.getShowDivBoxModel()" on page 926. dom.setShowDivOutlines()Availability Dreamweaver 8. Description This function turns the Layout Block Outlines visual aid on or off. Arguments show
Returns Nothing. Example See "dom.getShowDivOutlines()" on page 927. dreamweaver.cssRuleTracker.editSelectedRule()Availability Dreamweaver MX 2004. Description Lets the user edit the currently selected rule in the rule tracker. This function displays the selected rule in the CSS property grid, and if necessary, will show the property grid and its containing floater. Arguments None. Returns Nothing. Enabler See "dreamweaver.cssRuleTracker.canEditSelectedRule()" on page 1078. dreamweaver.cssRuleTracker.newRule()Availability Dreamweaver MX 2004. Description Opens the New CSS Style dialog box, so the user can create a new rule. Arguments None. Returns Nothing. dreamweaver.cssStylePalette.applySelectedStyle()Availability Dreamweaver MX. Description Applies the selected style to the current active document or to its attached style sheet, depending on the selection in the Styles panel. Arguments { pane }
Returns Nothing. Enabler See "dreamweaver.cssStylePalette.canApplySelectedStyle()" on page 1079. dreamweaver.cssStylePalette.attachStyleSheet()Availability Dreamweaver 4. Description Displays a dialog box that lets users attach a style sheet to the current active document or to one of its attached style sheets, depending on the selection in the Styles panel. Arguments None. Returns Nothing. dreamweaver.cssStylePalette.deleteSelectedStyle()Availability Dreamweaver 3. Description Deletes the style that is currently selected in the Styles panel from the document. Arguments { pane }
Returns Nothing. Enabler See "dreamweaver.cssStylePalette.canDeleteSelectedStyle()" on page 1079. dreamweaver.cssStylePalette.duplicateSelectedStyle()Availability Dreamweaver 3. Description Duplicates the style that is currently selected in the Styles panel and displays the Duplicate Style dialog box to let the user assign a name or selector to the new style. Arguments { pane }
Returns Nothing. Enabler See "dreamweaver.cssStylePalette.canDuplicateSelectedStyle()" on page 1080. dreamweaver.cssStylePalette.editSelectedStyle()Availability Dreamweaver 3. Description Opens the Style Definition dialog box for the style that is currently selected in the Styles panel. Arguments { pane }
Returns Nothing. Enabler See "dreamweaver.cssStylePalette.canEditSelectedStyle()" on page 1081. dreamweaver.cssStylePalette.editSelectedStyleInCodeview()Availability Dreamweaver 8. Description Ths function switches to Code view and moves the mouse pointer to the code for the style that is currently selected in the Styles panel. Arguments { pane }
Returns Nothing. Enabler See "dreamweaver.cssStylePalette.canEditSelectedStyleInCodeview()" on page 1081. dreamweaver.cssStylePalette.editStyleSheet()Availability Dreamweaver 3. Description Opens the Edit Style Sheet dialog box. Arguments None. Returns Nothing. Enabler See "dreamweaver.cssStylePalette.canEditStyleSheet()" on page 1082. dreamweaver.cssStylePalette.getDisplayStyles()Availability Dreamweaver 8. Description This function determines whether CSS styles are being rendered. The default value is TRue. Arguments None. Returns A Boolean value: true if CSS styles are being rendered; false otherwise. Example var areStylesRendered = dw.cssStylePalette.getDisplayStyles(); dreamweaver.cssStylePalette.getMediaType()Availability Dreamweaver MX 2004. Description Gets target media type for rendering. The default media type is "screen". Arguments None. Returns A string value that specifies the target media type. Example var mediaType = dw.cssStylePalette.getMediaType(); dreamweaver.cssStylePalette.getSelectedStyle()Availability Dreamweaver 3; fullSelector available in Dreamweaver MX. Description Gets the name of the style that is currently selected in the Styles panel. Arguments fullSelector
Returns When the fullSelector argument is a TRue value, the function returns either the full selector or an empty string when the stylesheet node is selected. When the fullSelector argument is a false value or it is omitted, a string that represents the class name of the selected style returns. If the selected style does not have a class or a stylesheet node is selected, an empty string returns. Example If the style red is selected, a call to the dw.cssStylePalette.getSelectedStyle() function returns "red". dreamweaver.cssStylePalette.getSelectedTarget() (deprecated)Availability Dreamweaver 3; deprecated in Dreamweaver MX because there is no longer an Apply To Menu in the Styles panel. Description This function gets the selected element in the Apply To pop-up menu at the top of the Styles panel. Arguments None. Returns A deprecated function; always returns a null value. dreamweaver.cssStylePalette.getStyles()Availability Dreamweaver 3. Description Gets a list of all the class styles in the active document. Without arguments it just returns class selector names. If the bGetIDs argument is true, it returns just ID selector names. In either case, if the bGetFullSelector argument is true, it returns the full selector name. For example, given an HTML file with the following code: <style> .test{ background:none }; p.foo{ background:none }; #bar {background:none }; div#hello p.world {background:none}; The calls in the following table return the values in the Result column.
Arguments {bGetIDs, bGetFullSelector}
Returns An array of strings that represent the names of all the class styles in the document. Example If the Styles panel is set up as shown in the following figure, a call to the dreamweaver.cssStylePalette.getStyles() function returns an array that contains these strings: "BreadcrumbEnd", "change", "doctitle", "heading", and "highlight": dreamweaver.cssStylePalette.newStyle()Availability Dreamweaver 3. Description Opens the New Style dialog box. Arguments None. Returns Nothing. dreamweaver.cssStylePalette.renameSelectedStyle()Availability Dreamweaver 3. Description Renames the class name that is used in the currently selected rule in the Styles panel and all instances of the class name in the selected rule. Arguments { pane }
Returns Nothing. Enabler See "dreamweaver.cssStylePalette.canRenameSelectedStyle()" on page 1082. dreamweaver.cssStylePalette.setDisplayStyles()Availability Dreamweaver 8. Description This functon determines whether to render CSS styles and refreshes the rendering of all open documents. Arguments display
Returns Nothing. Example The following example turns off rendering of CSS styles: dw.cssStylePalette.setDisplayStyles(false); dreamweaver.cssStylePalette.setMediaType()Availability Dreamweaver MX 2004. Description Sets the target media type for rendering. Refreshes the rendering of all open documents. Arguments mediaType
Returns Nothing. Example dw.cssStylePalette.setMediaType("print"); dreamweaver.getBlockVisBoxModelColors()Availability Dreamweaver 8. Description This function gets the colors used to render the box model for a selected block when the Layout Block Box Model visual aid is on. Arguments None. Returns An array of strings that contains two strings:
Example The following example checks the value of the margin and padding color; if either isn't white, it sets them both to white: var boxColors = dreamweaver.getBlockVisBoxModelColors(); if ((boxColors[0] != "#FFFFFF") || (boxColors[1] != "#FFFFFF)){ currentDOM.setBlockVisBoxModelColors("#FFFFFF", "#FFFFFF"); } dreamweaver.getBlockVisOutlineProperties()Availability Dreamweaver 8. Description This function gets the outline properties for the block visualization visual aids. Arguments forWhat
Returns An array of strings that contains three strings:
Example The following example gets the outline properties for "divs" and makes the outline style "SOLID": var outlineStyle = dw.getBlockVisOutlineProperties("divs"); if (outlineStyle[2] != "SOLID"){ dw.setBlockVisOutlineProperties("divs", outlineStyle[0], outlineStyle[1], "SOLID"); } dreamweaver.getDivBackgroundColors()Availability Dreamweaver 8. Description This function gets the colors used by the Layout Block Backgrounds visual aid. Arguments None. Returns An array of strings that contains the 16 colors, with each color represented by the hexadecimal value of the RGB color, in the form #RRGGBB. Example The following example gets the background colors used by the Layout Block Backgrounds visual aid: var backgroundColors = dreamweaver.getDivBackgroundColors(); dreamweaver.setBlockVisOutlineProperties()Availability Dreamweaver 8. Description This function sets the outline properties for the block visualization visual aids. Arguments forWhat, color, width, {style}
Returns Nothing. Example See "dreamweaver.getBlockVisOutlineProperties()" on page 942. dreamweaver.setDivBackgroundColors()Availability Dreamweaver 8. Description This function sets the colors used by the Layout Block Backgrounds visual aid. Arguments colors
Returns Nothing. Example The following example makes sure there are no more than 16 colors specified as div background colors and, if so, sets the colors used as background colors to shades of gray: var currentDOM = dw.getDocumentDOM(); var divColors = currentDOM.getDivBackgroundColors("divs"); var shadesOfGray = new Array["#000000", "#111111", "#222222", "#333333", "#444444", "#555555", "#666666", "#777777", "#888888", "#999999", "#AAAAAA", "#BBBBBB", "#CCCCCC", "#DDDDDD", "#EEEEEE", "#FFFFFF"] var howManyColors = divColors.length; if howManyColors <= 16{ for (var i = 0; i < howManyColors; i++) { currentDOM.setDivBackgroundColors("divs", shadeOfGray[i]); } |
< Day Day Up > |