
定义和用法
removeAttributeNS() 方法删除通过命名空间和名称指定的属性。
语法
elementNode.removeAttributeNS(ns,name)
参数 | 描述 |
---|---|
ns | 必需。规定要删除的属性的命名空间。 |
name | 必需。规定要删除的属性的名称。 |
实例
实例
xmlDoc=loadXMLDoc("books_ns.xml");
x=xmlDoc.getElementsByTagName("title")[0];
ns="/w3cnote/";
document.write("Attribute Found: ");
document.write(x.hasAttributeNS(ns,"lang"));
x.removeAttributeNS(ns,"lang");
document.write("<br>Attribute Found: ");
document.write(x.hasAttributeNS(ns,"lang"));
输出:
Attribute Found: true
Attribute Found: false
Attribute Found: false
