JavaScript Reference/Javascript Methods/createTextRange

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

"createTextRange()" Example

   <source lang="javascript">
   

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

   var myNode = document.body.createTextRange();
   myNode.text = "text for new text range"; 

} </script> <button onclick="function1();">Create text range</button> </body> </html>


     </source>
   
  


"createTextRange()" is applied to

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | Applied_To |<body> <button> | | |<input type="button"> <input type="hidden"> | | |<input type="password"> <input type="reset"> | | |<input type="submit"> <input type="text"> | | |<textarea> | +----------------+--------------------------------------------------------------+

     </source>
   
  


"createTextRange()" Syntax, Parameters and Note

   <source lang="javascript">

Note: Creates a new TextRange object with the text contained by the element.

Syntax:

document.all.elementID.createTextRange()


     </source>