JavaScript DHTML/HTML/Paragraph
Версия от 13:02, 26 мая 2010; (обсуждение)
Change paragraph text
<source lang="html4strict">
<html> <head> <title>A Simple Page</title> <script type="text/javascript"> function modify() {
var newElem = document.createElement("p"); newElem.id = "newP"; var newText = document.createTextNode("This is the second paragraph."); newElem.appendChild(newText); document.body.appendChild(newElem); document.getElementById("emphasis1").childNodes[0].nodeValue = "first";
} </script> </head> <body> <button onclick="modify()">Add/Replace Text</button>
This is the one and only paragraph on the page.
</body> </html>
</source>