JavaScript Reference/Javascript Methods/moveToElementText

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

"moveToElementText()" Example

   <source lang="javascript">
   

<html> <body> <script language="JavaScript"> function function1(){

  var myRange1 = document.body.createTextRange();
  myRange1.moveToElementText(myDiv1);
  myRange1.findText("test");
  myRange1.select(); 

} </script>

Testing

<input type="button" value="MoveToElementText" onclick="function1();"> </body> </html>


     </source>
   
  


"moveToElementText()" is applied to

   <source lang="javascript">

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

     </source>
   
  


"moveToElementText()" Syntax, Parameters and Note

   <source lang="javascript">

Note: Moves a text range to encompass the contents.

Syntax:

textRangeName.moveToElementText(param1) Parameters:

   param1   Required; the element to which the text range will be moved.
   
     
     </source>