<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<p> HeLLO WORD</p>
<input type="button" οnclick="replace()" value="点击" />
<script>
//1.remove child
function remove(){
var p =document.getElementsByTagName('p')[0]
document.body.removeChild(p)
}
// 2.
function clone(){
var p =document.getElementsByTagName('p')[0]
var newp= p.cloneNode(true)
document.body.appendChild(newp)
}
// 3.
function replace(){
var p =document.getElementsByTagName('p')[0]
var div =document.createElement('div')
var text = document.createTextNode('hELLO qd')
div.appendChild(text)
document.body.replaceChild(div,p)
}
</script>
</body>
</html>
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;head&gt;&lt;met