搞不明白哪错了。。。求大神指点!!!
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
function replace() {
var myvalue1 = document.getElementById("tag").value;
var myvalue2 = document.getElementById("txt").value;
var myp=document.getElementById("lvye");
var e=document.createElement(myvalue1);
var t=document.createTextNode(myvalue2);
e.appendChild(t);
document.replaceChild(e,myp);
}
</script>
</head>
<body>
<p id="lvye">慕课网</p>
<hr />
输入标签:<input id="tag" type="text"/><br />
输入文本:<input id="txt" type="text"/><br />
<input type="button" value="替换" onclick="replace()" />
</body>
</html>