JavaScript Reference/Javascript Methods/moveToPoint

Материал из Web эксперт
Перейти к: навигация, поиск

"moveToPoint()" Example

   <source lang="javascript">
   

<html> <body> <script language="JavaScript"> function function1(){

  var range = document.body.createTextRange();
  var myX = window.event.clientX;
  var myY = window.event.clientY;
  range.moveToPoint(myX, myY);
  range.expand("sentence");
  range.select();}

</script> <body onclick="function1();">Sample text range, click here</body> </body> </html>


     </source>
   
  


"moveToPoint()" is applied to

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | Applied_To |TextRange | +----------------+--------------------------------------------------------------+

     </source>
   
  


"moveToPoint()" Syntax, Parameters and Note

   <source lang="javascript">

Note: Compacts the text and moves the empty text range.

Syntax:

textRangeName.moveToPoint(param1, param2) Parameters:

   param1   Required; the X coordinate of the point.
   param2   Required; the Y coordinate of the point.
   
     
     </source>