aboutsummaryrefslogtreecommitdiff
path: root/files/pt-br/web/api/element/setattributens/index.html
blob: d4837965a7c07711e23a3b5c0459d278dc68ccb8 (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
---
title: Element.setAttributeNS()
slug: Web/API/Element/setAttributeNS
translation_of: Web/API/Element/setAttributeNS
---
<p>{{ APIRef("DOM") }}</p>

<p><code>setAttributeNS</code> adiciona um novo atributo ou modifica o valor de um atributo com um namespace e um nome.</p>

<p>Syntax</p>

<pre class="eval"><em>element</em>.setAttributeNS(<em>namespace</em>,<em>name</em>,<em>value</em>)
</pre>

<ul>
 <li><code>namespace</code> é uma string especificando o namespace do atributo.</li>
 <li><code>name</code> é uma string identificando o atributo que sera definido.</li>
 <li><code>value</code> é o novo valor desejado para o atributo.</li>
</ul>

<h2 id="Example" name="Example">Exemplo</h2>

<pre class="eval">var d = document.getElementById("d1");
d.setAttributeNS("<span class="nowiki">http://www.mozilla.org/ns/specialspace</span>", "align", "center");
</pre>

<h2 id="Notes" name="Notes">Notas</h2>

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

<h2 id="Specification" name="Specification">Especificação</h2>

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