aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/element/getattributenodens/index.html
blob: 5b1c9d81818771ac51fe9de64dcaeeec505cf99d (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
---
title: Element.getAttributeNodeNS()
slug: Web/API/Element/getAttributeNodeNS
tags:
  - API
  - DOM
translation_of: Web/API/Element/getAttributeNodeNS
---
<p>{{ APIRef("DOM") }}</p>

<h2 id="Summary" name="Summary">概要</h2>

<p>通过命名空间 URI 和名称来获取属性节点。</p>

<h2 id="Syntax" name="Syntax">语法</h2>

<pre class="eval"><em>attributeNode</em> = element.getAttributeNodeNS(<em>namespace</em>,<em>nodeName</em>)
</pre>

<ul>
 <li><code>attributeNode</code> 获取的属性节点.</li>
 <li><code>namespace</code> 命名空间字符串</li>
 <li><code>nodeName</code> 属性节点的名称.</li>
</ul>

<p><span class="comment">== Example == TBD The example needs to be fixed pre&gt; // html: &lt;div id="top" /&gt; t = document.getElementById("top"); specialNode = t.getAttributeNodeNS( "<a class="external" href="http://www.mozilla.org/ns/specialspace" rel="freelink">http://www.mozilla.org/ns/specialspace</a>", "id"); // iNode.value = "full-top" &lt;/pre</span></p>

<h2 id="Notes" name="Notes">笔记</h2>

<p><code>getAttributeNodeNS</code> 相比 <a href="en/DOM/element.getAttributeNode">getAttributeNode</a> 更加具体,允许你在特定的命名空间里获取属性. 对应的 setter 方法是 <a href="en/DOM/element.setAttributeNodeNS">setAttributeNodeNS</a>.</p>

<p>{{ DOMAttributeMethods() }}</p>

<h2 id="Specification" name="Specification">规格</h2>

<p><a class="external" href="http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-ElGetAtNodeNS">DOM Level 2 Core: getAttributeNodeNS</a></p>