JavaScript Reference/Javascript Properties/text TextRange

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

"text" Example

   <source lang="javascript">
   

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

   textRange = document.body.createTextRange();
   textRange.text = "This is a test";

} </script> <button onclick="function1();">See Text in TextRange</button> </body> </html>


     </source>
   
  


"text" is applied to

   <source lang="javascript">

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

     </source>
   
  


"text" Syntax and Note

   <source lang="javascript">

Note: Read and write property. Sets the text string in the textRange object.

Syntax:

textRangeName.text = value


     </source>