Home | Top | Website design | JavaScript Editor JavaScript EditorGet Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.


setEnd Method

Sets the end position of a Range.

Syntax

range.setEnd(endNode,endOffset);
 

Parameters

The setEnd method takes the following parameters:

endNode
 

The Node to end the Range

endOffset
 

An integer greater than or equal to zero representing the offset for the end of the Range from the start of endNode.


Example

range = document.createRange();
 
endNode = document.getElementsByTagName("p").item(3);
 
endOffset = document.getElementsByTagName("p").item(3).childNodes.length;
 
range.setEnd(endNode,endOffset);
 

 

Notes

If the endNode is a Node of type Text, Comment, or CDATASection, then endOffset is the number of characters from the start of endNode. For other Node types, endOffset is the number of child nodes between the start of the endNode.

Specification:

setEnd

Home | Top | Website design | JavaScript Editor JavaScript EditorGet Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.