MACROMEDIA DREAMWEAVER 8-DREAMWEAVER API Specifiche Pagina 547

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 692
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 546
547
Description
Gets the position of a specific node in the DOM tree, which is expressed as character offsets into
the documents source code. It is valid for any document on a local drive.
Arguments
node
node
must be a tag, comment, or range of text that is a node in the tree that
dreamweaver.getDocumentDOM() returns.
Returns
An array that contains two integers. The first integer is the character offset of the beginning of the
tag, text, or comment. The second integer is the character offset of the end of the node, from the
beginning of the HTML document.
Enabler
None.
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 beginning and end points. It is valid for any document on a local drive.
Arguments
offsetBegin, offsetEnd
The arguments are the beginning and end points, respectively, of a range of characters, expressed
as character offsets from the beginning of the documents source code.
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.');
}
Vedere la pagina 546
1 2 ... 542 543 544 545 546 547 548 549 550 551 552 ... 691 692

Commenti su questo manuale

Nessun commento