📄 例9-2.html
字号:
<html>
<head>
<title>节点及节点接口的应用</title>
</head>
<body>
<H1>添加元素示例</H1>
<xml id="isle" src="EX9_1.XML">
</xml>
<script language="vbscript">
set mydoc=isle
if mydoc.parseError<>0 Then
MsgBox mydoc.parseError.reason
Else
set roote=mydoc.documentElement
set childlist=roote.childNodes
document.write "<p>添加元素前,元素的个数和最后一个元素名称为:</p>"
document.write "<LI>" &childlist.length & "<BR> "
document.write "<LI>" & roote.lastChild.nodeName & "<BR>"
set newe1=mydoc.createElement("good")
set dummy=roote.appendChild(newe1)
document.write "<p>添加元素后,元素的个数和最后一个元素名称为:</p>"
document.write "<LI>" & (childlist.length) & "<BR>"
document.write "<LI>" & (roote.lastChild.nodeName) & "<BR>"
End If
</script>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -