XML DOM removeAttributeNS método ()
Definición y Uso
removeAttributeNS método () elimina un determinado por las propiedades de espacio de nombres y el nombre.
gramática
elementNode.removeAttributeNS(ns,name)
参数 | 描述 |
---|---|
ns | 必需。规定要删除的属性的命名空间。 |
name | 必需。规定要删除的属性的名称。 |
Ejemplos
El fragmento de código siguiente utiliza loadXMLDoc () a " books_ns.xml " en xmlDoc, y quitar el elemento de primera "lang" <title>:
Ejemplos
xmlDoc=loadXMLDoc("books_ns.xml");
x=xmlDoc.getElementsByTagName("title")[0];
ns="http://www.w3schools.com/children/";
document.write("Attribute Found: ");
document.write(x.hasAttributeNS(ns,"lang"));
x.removeAttributeNS(ns,"lang");
document.write("
Attribute Found: ");
document.write(x.hasAttributeNS(ns,"lang"));
x=xmlDoc.getElementsByTagName("title")[0];
ns="http://www.w3schools.com/children/";
document.write("Attribute Found: ");
document.write(x.hasAttributeNS(ns,"lang"));
x.removeAttributeNS(ns,"lang");
document.write("
Attribute Found: ");
document.write(x.hasAttributeNS(ns,"lang"));
salida:
Attribute Found: true
Attribute Found: false
Attribute Found: false
Trate »
objeto Element