准备工作:
<html>
<head>
<title>JavaScript and the Document Object Model</title>
</head>
<body>
<div id="page">
<div id="header"><h1 id="title">Page title</h1></div>
<div id="content">
<h2>Content title</h2>
<p>Some copy goes here</p>
<p>More copy goes here</p>
</div>
</div>
</body>
</html>
1.使用以下属性,可以获得文档的节点:
firstChild
lastChild
nextSibling
previousSibling
parentNode .
childNodes
2.使用以下属性,可以用来操作节点的值
nodeValue.
3.使用以下属性,可以用来增加,删除,替换文档中的节点
appendChild method
insertBefore method
removeChild method
replaceChild method