Posted on 2008-12-05 11:34
☆ 阅读(93)
评论(0) 编辑 收藏 所属分类:
javascript操作XML
<%@ page contentType="text/html; charset=GBK"%>
<html>
<head>
<script type="text/javascript" src="loadxmldoc.js">
</script>
</head>
<body>
先创建一个新节点,得到一个节点对象,将新节点加到该节点对象上面。
<script type="text/javascript">
xmlDoc=loadXMLDoc("books.xml");
newel=xmlDoc.createElement("edition");
x=xmlDoc.getElementsByTagName("book")[0];
x.appendChild(newel);
</script>
</body>
</html>