JavaScript Reference/Javascript Methods/moveStart

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

"moveStart()" Example

   <source lang="javascript">
   

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


     </source>
   
  


"moveStart()" is applied to

   <source lang="javascript">

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

     </source>
   
  


"moveStart()" Syntax, Parameters and Note

   <source lang="javascript">

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.
   
     
     </source>