把javascript 换成了html。我现在想再把html换成javascript,但是没有反映, - - 求助
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
</head>
<body>
<div><p id="oldnode">JavaScript</p></div>
<a href="javascript:replaceMessage1()"> 将“javascript”换为“HTML”</a><br>
<a href="javascript:replaceMessage2()"> 将“HTML”换为“javascript”</a>
<script type="text/javascript">
function replaceMessage1(){
var newnode=document.createElement("p");
var newnodetext=document.createTextNode("HTML");
newnode.appendChild(newnodetext);
var oldnode=document.getElementById("oldnode");
oldnode.parentNode.replaceChild(newnode,oldnode);
}
function replaceMessage2(){
var newnode=document.createElement("p");
var newnodetext=document.createTextNode("javascript");
newnode.appendChild(newnodetext);
var oldnode=document.getElementById("oldnode");
oldnode.parentNode.replaceChild(newnode,oldnode);
}
</script>
</body>
</html>