标签:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
</head>
<body>
<ul id="test">
<li>JavaScript</li>
<li>HTML</li>
</ul>
<script type="text/javascript">
var otest = document.getElementById("test");
var newnode = document.createElement("li");
newnode.innerHTML = "PHP";
otest.appendChild(newnode);
</script>
</body>
</html>
appendChild(newnode)在指定节点的最后一个子节点列表之后添加一个新的子节点
标签:
原文地址:http://www.cnblogs.com/xyw521520/p/5361448.html