JavaScript Reference/Javascript Properties/data TextNode

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

"data" Example

   <source lang="javascript">
   

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

   var myText = document.createTextNode();
   myText.data="Data Property for textNode";
   alert(myText.data);

} </script> <button onclick="function1();">View Node Value</button> </body> </html>


     </source>
   
  


"data" is applied to

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | Applied_To |TextNode | +----------------+--------------------------------------------------------------+

     </source>
   
  


"data" Syntax and Note

   <source lang="javascript">

Note: Read and write property. Sets the string content for text node.

Syntax:

textNodeName.data = value


     </source>