JavaScript Tutorial/DOM Node/Replace — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 11:24, 26 мая 2010
Replace a child
<source lang="javascript">
<html> <head> <title>replaceChild() Example</title> <script type="text/javascript">
function replaceMessage() { var oNewP = document.createElement("p"); var oText = document.createTextNode("www.wbex.ru"); oNewP.appendChild(oText); var oOldP = document.body.getElementsByTagName("p")[0]; oOldP.parentNode.replaceChild(oNewP, oOldP); }
</script> </head> <body onload="replaceMessage()">
A
C
D
</body> </html></source>