JavaScript DHTML/HTML/Paragraph — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
|
Текущая версия на 10:23, 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>