XML DOM removeAttributeNS()メソッド
Element オブジェクト
定義と使用法
removeAttributeNS() メソッドは、名前空間と名前で指定された属性を削除します。
構文
elementNode.removeAttributeNS(ns,name)
| パラメータ | 説明 |
|---|---|
| ns | 必須。削除する属性の名前空間を指定します。 |
| name | 必須。削除する属性の名前を指定します。 |
例
次のコードスニペットはloadXMLDoc()「」を xmlDoc に読み込み、最初の <title> 要素の "lang" 属性を削除します:
例
xmlDoc=loadXMLDoc("books_ns.xml");
x=xmlDoc.getElementsByTagName("title")[0];
ns="http://www.example.com/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
試してみる »
Element オブジェクト その他の拡張