案例:XML DOM案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html>
2
<head>
3
<script type="text/javascript" src="/example/xdom/loadxmldoc.js"> 
4
</script>
5
</head>
6
<body>
7
8
<script type="text/javascript">
9
xmlDoc=loadXMLDoc("/example/xdom/books_ns.xml");
10
11
x=xmlDoc.getElementsByTagName("title")[0];
12
ns="//www.w3xue.com/children/";
13
14
document.write("Attribute Found: ");
15
document.write(x.hasAttributeNS(ns,"lang"));
16
17
x.removeAttributeNS(ns,"lang");
18
19
document.write("<br />Attribute Found: ");
20
document.write(x.hasAttributeNS(ns,"lang"));
21
22
</script>
23
</body>
24
</html>
25