blob: f1c35b27fdcc9efc8cfd2e735faa64a0487c8312 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
---
title: Element.removeAttributeNS()
slug: Web/API/Element/removeAttributeNS
translation_of: Web/API/Element/removeAttributeNS
---
<p>{{ APIRef("DOM") }}</p>
<p><code>removeAttributeNS</code> 移除元素的指定属性</p>
<p>{{ Fx_minversion_inline(3) }} 在Firefox 3及更高版本中,此方法会将DOM值重置为其默认值。</p>
<h2 id="Syntax" name="Syntax">用法</h2>
<pre class="eval"><em>element</em>.removeAttributeNS(<em>namespace</em>,<em>attrName</em>);
</pre>
<ul>
<li><code>namespace</code> 包含当前属性的namespace字符串</li>
<li><code>attrName</code> 当前移除的属性名字符串</li>
</ul>
<h2 id="Example" name="Example">例子</h2>
<pre>// <div id="div1" xmlns:special="http://www.mozilla.org/ns/specialspace"
// special:specialAlign="utterleft" width="200px" />
d = document.getElementById("div1");
d.removeAttributeNS("http://www.mozilla.org/ns/specialspace", "specialAlign");
// now: <div id="div1" width="200px" />
</pre>
<h2 id="Notes" name="Notes">Notes</h2>
<p>{{ DOMAttributeMethods() }}</p>
<h2 id="Specification" name="Specification">Specification</h2>
<p><a class="external" href="http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-ElRemAtNS">DOM Level 2 Core: removeAttributeNS</a></p>
|