JavaScript Reference/Javascript Methods/move
Версия от 18:30, 25 мая 2010; (обсуждение)
"move()" Example
<html>
<body>
<script language="JavaScript">
var range;
function function1(elem) {
range = elem.createTextRange()
var m = range.move("word", 2)
range.select()
}
</script>
<input id="myT" type="text" value="Some sample text">
<input type="button" value="Move cursor" onclick="function1(myT);">
</body>
</html>
"move()" is applied to
+----------------+--------------------------------------------------------------+
| Applied_To |TextRange |
+----------------+--------------------------------------------------------------+
"move()" Syntax, Parameters and Note
Note:
Compacts the text and moves the insertion point of a text to a new location,
and returns the number of units moved.
Syntax:
textRangeName.move(param1, param2)
Parameters:
param1 Required; the type of units to move.
character,
word,
sentence,
textedit.
param2 Optional; the number of units to move.