![MACROMEDIA DREAMWEAVER MX 2004-DREAMWEAVER API Reference Download Page 281](http://html1.mh-extra.com/html/macromedia/dreamweaver-mx-2004-dreamweaver-api/dreamweaver-mx-2004-dreamweaver-api_reference_3336554281.webp)
Selection functions
281
Example
The following code selects the first image object in the current document:
var theDOM = dw.getDocumentDOM();
var theImg = theDOM.images[0];
var offsets = theDom.nodeToOffsets(theImg);
theDom.setSelection(offsets[0], offsets[1]);
dom.offsetsToNode()
Availability
Dreamweaver 3.
Description
Gets the object in the DOM tree that completely contains the range of characters between the
specified opening and closing points. It is valid for any document on a local drive.
Arguments
offsetBegin
,
offsetEnd
•
The
offsetBegin
argument specifies the offset from the beginning of the document to the
beginning of a range of characters that is an object in the DOM tree.
•
The
offsetEnd
argument specifies the offset from the beginning of the document to the end
of a range of characters that is an object in the DOM tree.
Returns
The tag, text, or comment object that completely contains the specified range of characters.
Example
The following code displays an alert if the selection is an image:
var offsets = dom.getSelection();
var theSelection = dreamweaver.offsetsToNode(offsets[0], ¬
offsets[1]);
if (theSelection.nodeType == Node.ELEMENT_NODE && ¬
theSelection.tagName == 'IMG'){
alert('The current selection is an image.');
}
dom.selectAll()
Availability
Dreamweaver 3.
Description
Performs a Select All operation.
Note:
In most cases, this function selects all the content in the active document. In some cases (for
example, when the insertion point is inside a table), it selects only part of the active document. To set
the selection to the entire document, use
dom.setSelection()
.
000_DW_API_Print.book Page 281 Wednesday, August 20, 2003 9:14 AM
Summary of Contents for DREAMWEAVER MX 2004-DREAMWEAVER API
Page 1: ...Dreamweaver API Reference...
Page 24: ...24 Contents...
Page 32: ......
Page 70: ...70 Chapter 5 Fireworks Integration...
Page 76: ...76 Chapter 6 Flash Integration...
Page 116: ...116 Chapter 9 The JavaBeans API...
Page 140: ......
Page 152: ...152 Chapter 11 Application...
Page 218: ...218 Chapter 12 Workspace...
Page 248: ...248 Chapter 13 Site...
Page 292: ...292 Chapter 14 Document...
Page 378: ...378 Chapter 17 Design...
Page 430: ...430 Chapter 18 Code...
Page 486: ...486 Index...