'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>
Related examples in the same category