DHTML Methods
Moves the start and end positions of the text range to the given point.
TextRange.moveToPoint ( iX, iY )
iX |
Required. Horizontal offset relative to the upper-left corner of the window, in pixels. |
iY |
Required. Vertical offset relative to the upper-left corner of the window, in pixels. |
No return value.
The coordinates of the point must be in pixels and be relative to the upper-left corner of the window. The resulting text range is empty, but it can be expanded and moved using methods such as expand and moveEnd.
This feature might not be available on non-Win32® platforms. See the Microsoft® Knowledge Base for the latest information on Internet Explorer® cross-platform compatibility.
The following JScript™ ( compatible with ECMA-262 language specification ) example moves the text range to the point where the user clicked the mouse, expands the range, and selects the text within the new range.
<script FOR=document EVENT=onclick language="JScript"
var rng = document.body.createTextRange ( );
rng.moveToPoint ( window.event.x, window.event.y );
rng.expand ( "word" );
rng.select ( );
</script>
TextRange