< Day Day Up > |
You handle general editing functions in the Document window. These functions insert text, HTML, and objects; apply, change, and remove font and character markup; modify tags and attributes; and more. dom.applyCharacterMarkup()Availability Dreamweaver 3. Description Applies the specified type of character markup to the selection. If the selection is an insertion point, it applies the specified character markup to any subsequently typed text. Arguments tagName
Returns Nothing. dom.applyFontMarkup()Availability Dreamweaver 3. Description Applies the FONT tag and the specified attribute and value to the current selection. Arguments attribute, value
Returns Nothing. dom.deleteSelection()Availability Dreamweaver 3. Description Deletes the selection in the document. Arguments None. Returns Nothing. dom.editAttribute()Availability Dreamweaver 3. Description Displays the appropriate interface for editing the specified Document attribute. In most cases, this interface is a dialog box. This function is valid only for the active document. Arguments attribute
Returns Nothing. dom.exitBlock()Availability Dreamweaver 3. Description Exits the current paragraph or heading block, leaving the insertion point outside all block elements. Arguments None. Returns Nothing. dom.getCharSet()Availability Dreamweaver 4. Description Returns the charset attribute in the meta tag of the document. Arguments None. Returns The encoding identity of the document. For example, for a Latin1 document, the function returns iso-8859-1. dom.getFontMarkup()Availability Dreamweaver 3. Description Gets the value of the specified attribute of the FONT tag for the current selection. Arguments attribute
Returns A string that contains the value of the specified attribute or an empty string if the attribute is not set. dom.getLineFromOffset()Availability Dreamweaver MX. Description Finds the line number of a specific character offset in the text (the HTML or JavaScript code) of the file. Arguments offset
Returns An integer that represents the line number in the document. dom.getLinkHref()Availability Dreamweaver 3. Description Gets the link that surrounds the current selection. This function is equivalent to looping through the parents and grandparents of the current node until a link is found and then calling the getAttribute('HREF') on the link. Arguments None. Returns A string that contains the name of the linked file, which is expressed as a file:// URL. dom.getLinkTarget()Availability Dreamweaver 3. Description Gets the target of the link that surrounds the current selection. This function is equivalent to looping through the parents and grandparents of the current node until a link is found and then calling the getAttribute('TARGET') function on the link. Arguments None. Returns A string that contains the value of the TARGET attribute for the link or an empty string if no target is specified. dom.getListTag()Availability Dreamweaver 3. Description Gets the style of the selected list. Arguments None. Returns A string that contains the tag that is associated with the list ("ul", "ol", or "dl") or an empty string if no tag is associated with the list. This value always returns in lowercase letters. dom.getTextAlignment()Availability Dreamweaver 3. Description Gets the alignment of the block that contains the selection. Arguments None. Returns A string that contains the value of the ALIGN attribute for the tag that is associated with the block or an empty string if the ALIGN attribute is not set for the tag. This value always returns in lowercase letters. dom.getTextFormat()Availability Dreamweaver 3. Description Gets the block format of the selected text. Arguments None. Returns A string that contains the block tag that is associated with the text (for example, "p", "h1", "pre", and so on) or an empty string if no block tag is associated with the selection. This value always returns in lowercase letters. dom.hasCharacterMarkup()Availability Dreamweaver 3. Description Checks whether the selection already has the specified character markup. Arguments markupTagName
Returns A Boolean value that indicates whether the entire selection has the specified character markup. The function returns a value of false if only part of the selection has the specified markup. dom.indent()Availability Dreamweaver 3. Description Indents the selection using BLOCKQUOTE tags. If the selection is a list item, this function indents the selection by converting the selected item into a nested list. This nested list is of the same type as the outer list and contains one item, the original selection. Arguments None. Returns Nothing. dom.insertHTML()Availability Dreamweaver 3. Description Inserts HTML content into the document at the current insertion point. Arguments contentToInsert, {bReplaceCurrentSelection}
Returns Nothing. Example The following code inserts the HTML string <b>130</b> into the current document: var theDOM = dw.getDocumentDOM(); theDOM.insertHTML('<b>130</b>'); The result appears in the Document window, as shown in the following figure: dom.insertObject()Availability Dreamweaver 3. Description Inserts the specified object, prompting the user for parameters if necessary. Arguments objectName
Returns Nothing. Example A call to the dom.insertObject('Button') function inserts a form button into the active document after the current selection. If nothing is selected, this function inserts the button at the current insertion point. NOTE Although object files can be stored in separate folders, it's important that these files have unique names. If a file called Button.htm exists in the Forms folder and also in the MyObjects folder, Dreamweaver cannot distinguish between them. dom.insertText()Availability Dreamweaver 3. Description Inserts text content into the document at the current insertion point. Arguments contentToInsert, {bReplaceCurrentSelection}
Returns Nothing. Example The following code inserts the text: <b>130</b> into the current document: var theDOM = dreamweaver.getDocumentDOM(); theDOM.insertText('<b>130</b>'); The results appear in the Document window, as shown in the following figure: dom.newBlock()Availability Dreamweaver 3. Description Creates a new block with the same tag and attributes as the block that contains the current selection or creates a new paragraph if the pointer is outside all blocks. Arguments None. Returns Nothing. Example If the current selection is inside a center-aligned paragraph, a call to the dom.newBlock() function inserts <p align="center"> after the current paragraph. dom.notifyFlashObjectChanged()Availability Dreamweaver 4. Description Tells Dreamweaver that the current Flash object file has changed. Dreamweaver updates the Preview display, resizing it as necessary, preserving the width-height ratio from the original size. For example, Flash Text uses this feature to update the text in the Layout view as the user changes its properties in the Command dialog box. Arguments None. Returns Nothing. dom.outdent()Availability Dreamweaver 3. Description Outdents the selection. Arguments None. Returns Nothing. dom.removeCharacterMarkup()Availability Dreamweaver 3. Description Removes the specified type of character markup from the selection. Arguments tagName
Returns Nothing. dom.removeFontMarkup()Availability Dreamweaver 3. Description Removes the specified attribute and its value from a FONT tag. If removing the attribute leaves only the FONT tag, the FONT tag is also removed. Arguments attribute
Returns Nothing. dom.removeLink()Availability Dreamweaver 3. Description Removes the hypertext link from the selection. Arguments None. Returns Nothing. dom.resizeSelection()Availability Dreamweaver 3. Description Resizes the selected object to the specified dimensions. Arguments newWidth, newHeight
Returns Nothing. dom.setAttributeWithErrorChecking()Availability Dreamweaver 3. Description Sets the specified attribute to the specified value for the current selection, prompting the user if the value is the wrong type or if it is out of range. This function is valid only for the active document. Arguments attribute, value
Returns Nothing. dom.setLinkHref()Availability Dreamweaver 3. Description Makes the selection a hypertext link or changes the URL value of the HREF tag that encloses the current selection. Arguments linkHREF
Returns Nothing. Enabler See "dom.canSetLinkHref()" on page 1065. dom.setLinkTarget()Availability Dreamweaver 3. Description Sets the target of the link that surrounds the current selection. This function is equivalent to looping through the parents and grandparents of the current node until a link is found and then calling the setAttribute('TARGET') function on the link. Arguments {linkTarget}
Returns Nothing. dom.setListBoxKind()Availability Dreamweaver 3. Description Changes the kind of the selected SELECT menu. Arguments kind
Returns Nothing. dom.showListPropertiesDialog()Availability Dreamweaver 3. Description Opens the List Properties dialog box. Arguments None. Returns Nothing. Enabler See "dom.canShowListPropertiesDialog()" on page 1065. dom.setListTag()Availability Dreamweaver 3. Description Sets the style of the selected list. Arguments listTag
Returns Nothing. dom.setTextAlignment()Availability Dreamweaver 3. Description Sets the ALIGN attribute of the block that contains the selection to the specified value. Arguments alignValue
Returns Nothing. dom.setTextFieldKind()Availability Dreamweaver 3. Description Sets the format of the selected text field. Arguments fieldType
Returns Nothing. dom.setTextFormat()Availability Dreamweaver 4. Description Sets the block format of the selected text. Arguments blockFormat
Returns Nothing. dom.showFontColorDialog()Availability Dreamweaver 3. Description Opens the Color Picker dialog box. Arguments None. Returns Nothing. dreamweaver.deleteSelection()Availability Dreamweaver 3. Description Deletes the selection in the active document or the Site panel; on the Macintosh, it deletes the text box that has focus in a dialog box or floating panel. Arguments None. Returns Nothing. Enabler See "dreamweaver.canDeleteSelection()" on page 1070. dreamweaver.editFontList()Availability Dreamweaver 3. Description Opens the Edit Font List dialog box. Arguments None. Returns Nothing. dreamweaver.getFontList()Availability Dreamweaver 3. Description Gets a list of all the font groups that appear in the text Property inspector and in the Style Definition dialog box. Arguments None. Returns An array of strings that represent each item in the font list. Example For the default installation of Dreamweaver, a call to the dreamweaver.getFontList() function returns an array that contains the following items:
dreamweaver.getFontStyles()Availability Dreamweaver 4. Description Returns the styles that a specified TrueType font supports. Arguments fontName
Returns An array of three Boolean values that indicates what the font supports. The first value indicates whether the font supports Bold, the second indicates whether the font supports Italic, and the third indicates whether the font supports both Bold and Italic. dreamweaver.getKeyState()Availability Dreamweaver 3. Description Determines whether the specified modifier key is depressed. Arguments key
Returns A Boolean value that indicates whether the key is pressed. Example The following code checks that both the Shift and Control keys (Windows) or Shift and Command keys (Macintosh) are pressed before performing an operation: if (dw.getKeyState("Shift") && dw.getKeyState("Cmd")){ // execute code } dreamweaver.getNaturalSize()Availability Dreamweaver 4. Description Returns the width and height of a graphical object. Arguments url
Returns An array of two integers where the first integer defines the width of the object, and the second defines the height. dreamweaver.getSystemFontList()Availability Dreamweaver 4. Description Returns a list of fonts for the system. This function can get either all fonts or only TrueType fonts. These fonts are needed for the Flash Text object. Arguments fontTypes
Returns An array of strings that contain all the font names; returns a value of null if no fonts are found. |
< Day Day Up > |