<html>
<head>
<title>替换节点</title>
<script type="text/javascript">
function replaceMessage(){
var oNewP=document.createElement("p");
var oText=document.createTextNode("hehe");
oNewP.appendChild(oText);
var oOldP=document.body.getElementsByTagName("p")[0];
oOldP.parentNode.replaceChild(oNewP,oOldP);
}
</script>
</head>
<body onload="replaceMessage()">
<p>haha</p>
</body>
</html>上面代码有什么问题?问什么不能将haha替换成hehe?