blob: 59a4d9809eb25e8daba9ea4dda40efcbb5c1a3eb (
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 añade un nuevo atributo o cambia el valor de un atributo con el namespace dado y el nombre.</code></p>
<h2 id="Sintaxis">Sintaxis</h2>
<pre class="eval"><em>elemento</em>.setAttributeNS(<em>namespace</em>,<em>nombre</em>,<em>valor</em>)
</pre>
<ul>
<li><code>namespace</code> es un string especificando el namespace del atributo.</li>
<li><code>name es un string identificando el atributo a ser puesto.</code></li>
<li><code>value es el string del valor deseado del nuevo atributo.</code></li>
</ul>
<h2 id="Example" name="Example">Ejemplo</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">Especificación</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>
|