<body>
<div><b id="oldnode">JavaScript</b>是一个很常用的技术,为网页添加动态效果。</div>
<a href="javascript:replaceMessage()"> 将加粗改为斜体</a>
<script type="text/javascript">
function replaceMessage(){
var newnode= document.createElement("p");
var newnodetext=document.createTextNode("nihhhhh");
newnode.appendChild(newnodetext);
oldnode=document.getElementById("oldnode");
oldnode.perentNode.replaceChild(newnode,oldnode);
}
</script>
</body>
oldnode.perentNode.replaceChild(newnode,oldnode);
parent