<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>javascript
<ul id="ul1">
<li>一</li>
<li>二</li>
<li id="li3">三</li>
<li>四</li>
<li id="li5">五</li>
</ul>html
</body>
<script type="text/javascript">
// var x=document.getElementById("ul1").childNodes;
// var y=document.getElementById("li3").lastChild;
// console.log(x);
// console.log(y);java
//建立節點
// var div=document.createElement("div");
// var tet=document.createTextNode("我是新建立的div");
// div.appendChild(tet);
// var add=document.getElementById("li3");
// add.appendChild(div);app
//克隆節點
// var clone=document.getElementById("li3").cloneNode("我是複製的li3");
// document.write(clone);htm
// 刪除節點
// document.getElementById("ul1").removeChild(document.getElementById("li3"));ip
//替換節點
document.getElementById("ul1").replaceChild(document.getElementById("li3"),document.getElementById("li5"));rem
</script>get
</html>it