JavaScript Reference/Javascript Methods/moveToPoint

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

"moveToPoint()" Example

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



"moveToPoint()" is applied to

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



"moveToPoint()" Syntax, Parameters and Note

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.