XML DOM removeAttribute () method
Definition and Usage
removeAttribute () method removes the specified property.
If the default value of the property is defined in the DTD, it will be with the default value when a new property appears.
grammar
elementNode.removeAttribute(name)
参数 | 描述 |
---|---|
name | 必需。规定要删除的属性。 |
Examples
The following code fragment uses loadXMLDoc () to " the Books.xml " into xmlDoc and delete "category" attributes of all <book> element:
Examples
xmlDoc=loadXMLDoc("books.xml");
x=xmlDoc.getElementsByTagName('book');
document.write(x[0].getAttribute('category'));
document.write("
");
x[0].removeAttribute('category');
document.write(x[0].getAttribute('category'));
x=xmlDoc.getElementsByTagName('book');
document.write(x[0].getAttribute('category'));
document.write("
");
x[0].removeAttribute('category');
document.write(x[0].getAttribute('category'));
try it"
Element object