aboutsummaryrefslogtreecommitdiff
path: root/files/pl/web/api/element/setattribute/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/pl/web/api/element/setattribute/index.html')
-rw-r--r--files/pl/web/api/element/setattribute/index.html34
1 files changed, 34 insertions, 0 deletions
diff --git a/files/pl/web/api/element/setattribute/index.html b/files/pl/web/api/element/setattribute/index.html
new file mode 100644
index 0000000000..79f649526e
--- /dev/null
+++ b/files/pl/web/api/element/setattribute/index.html
@@ -0,0 +1,34 @@
+---
+title: element.setAttribute
+slug: Web/API/Element/setAttribute
+tags:
+ - DOM
+ - Dokumentacja_Gecko_DOM
+ - Gecko
+ - Wszystkie_kategorie
+translation_of: Web/API/Element/setAttribute
+---
+<p>{{ ApiRef() }}</p>
+<h3 id="Podsumowanie" name="Podsumowanie">Podsumowanie</h3>
+<p><code>setAttribute</code> dodaje nowy lub zmienia wartość atrybutu w bieżącym elemencie.</p>
+<h3 id="Sk.C5.82adnia" name="Sk.C5.82adnia">Składnia</h3>
+<pre class="eval">element.setAttribute(<i>nazwa</i>,<i>wartość</i>)
+</pre>
+<h3 id="Parametry" name="Parametry">Parametry</h3>
+<ul>
+ <li><code>nazwa</code> to łańcuch znaków z nazwą nowego atrybutu,</li>
+ <li><code>wartość</code> to żądana wartość nowego atrybutu.</li>
+</ul>
+<h3 id="Przyk.C5.82ad" name="Przyk.C5.82ad">Przykład</h3>
+<pre>d = document.getElementById("d1");
+d.setAttribute("align", "center");
+</pre>
+<h3 id="Uwagi" name="Uwagi">Uwagi</h3>
+<p>Jeśli istnieje już atrybut o danej nazwie, jego wartość zostaje zmieniona na wartość podaną w wywołaniu <b>setAttribute</b>. Jeśli nie istnieje taki atrybut, zostanie on utworzony.</p>
+<p>Pomimo, że <a href="pl/DOM/element.getAttribute">getAttribute</a> zwraca <code>null</code> jeśli atrybut nie istnieje, do usuwania atrybutów powinieneś używać metody <a href="pl/DOM/element.removeAttribute">removeAttribute</a>, a nie <code>element.setAttribute(attr, null)</code>.</p>
+<p>{{ DOMAttributeMethods() }}</p>
+<h3 id="Specyfikacja" name="Specyfikacja">Specyfikacja</h3>
+<p><a class="external" href="http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-F68F082">DOM Level 2 Core: setAttribute</a> (wprowadzono w <a class="external" href="http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#method-setAttribute">DOM Level 1 Core</a>)</p>
+<div class="noinclude">
+  </div>
+<p>{{ languages( { "en": "en/DOM/element.setAttribute", "fr": "fr/DOM/element.setAttribute", "ja": "ja/DOM/element.setAttribute" } ) }}</p>