JavaScript DHTML/Javascript Objects/TextNode

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

"TextNode" Example

    
<html>
<head>
<script>
function replaceText(){
    var myTextNode = document.createTextNode("Text was replaced");
    var newTN = replaceMe.firstChild.replaceNode(myTextNode); 
} 
</script>
</head>
<p id="replaceMe">This is some text that will be replaced</p>
<button onclick="replaceText();">Replace text</button>
</body>
</html>