JavaScript Reference/Javascript Properties/data TextNode

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

"data" Example

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



"data" is applied to

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



"data" Syntax and Note

Note:
Read and write property. 
Sets the string content for text node.
    
Syntax:
    
textNodeName.data = value