moveToPointmoveToPoint*
*



Contents  *



Index  *Topic Contents
*Previous Topic: moveToElementText
*Next Topic: navigate

moveToPoint

Description

Moves the start and end positions of the text range to the given point. 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 can be expanded and moved using methods such as expand and moveEnd.

Syntax

object.moveToPoint(x, y)

ParameterDescription
x Integer specifying the x-coordinate, in pixels.
y Integer specifying the y-coordinate, in pixels.

Return Value

No return value.

Remarks

This feature might not be available on non-Win32 platforms. See article Q172976 in the Microsoft Knowledge Base for the latest information on Internet Explorer cross-platform compatibility.

Example

The following JScript example moves the text range to the same point as the user clicked the mouse, then 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>

Applies To

TextRange


Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.