JavaScript Reference/Javascript Methods/moveStart — различия между версиями

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

Текущая версия на 08:22, 26 мая 2010

"moveStart()" Example

    
<html>
<body>
<script language="JavaScript">
var range;
function function1(elem) {
    range = elem.createTextRange();
    var m = range.moveStart("textedit");
    range.select(); 
} 
</script>
<input id="myText" type="text" value="Some sample text. This text is editable" 
size="50">
<input type="button" 
       value="Move the start position to the end" onclick="function1(myText);">
</body>
</html>



"moveStart()" is applied to

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



"moveStart()" Syntax, Parameters and Note

Note:
Moves the start position of the text to a new location and returns 
the number of units moved.
    
Syntax:
    
textRangeName.moveStart(param1, param2)
Parameters:
    param1   Required; the type of units to move. 
                       character, 
                       word, 
                       sentence, 
                       textedit            start or end of the text range
    
    param2   Optional; the number of units to move.