asp.net.ph

Skip Navigation Links

moveToPoint Method

DHTML Methods


Moves the start and end positions of the text range to the given point.

Syntax

TextRange.moveToPoint ( iX, iY ) 
Parameters

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.

Return Value

No return value.

Remarks

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.

Example

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>
Applies To

TextRange



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note