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

1st JavaScript Editor.


setStart Method

Sets the start position of a Range.

Syntax

range.setStart(startNode,startOffset);
 

Parameters

The setStart method takes the following parameters:

startNode

The Node to start the Range

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

Example

range = document.createRange();
 
startNode = document.getElementsByTagName("p").item(2);
 
startOffset = 0;
 
range.setStart(startNode,startOffset);
 

Notes

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

Specification:

setStart

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

1st JavaScript Editor.