diff options
| author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:52 -0500 |
|---|---|---|
| committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:52 -0500 |
| commit | 074785cea106179cb3305637055ab0a009ca74f2 (patch) | |
| tree | e6ae371cccd642aa2b67f39752a2cdf1fd4eb040 /files/pl/mozilla/tech/xul/atrybut/id/index.html | |
| parent | da78a9e329e272dedb2400b79a3bdeebff387d47 (diff) | |
| download | translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.gz translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.bz2 translated-content-074785cea106179cb3305637055ab0a009ca74f2.zip | |
initial commit
Diffstat (limited to 'files/pl/mozilla/tech/xul/atrybut/id/index.html')
| -rw-r--r-- | files/pl/mozilla/tech/xul/atrybut/id/index.html | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/files/pl/mozilla/tech/xul/atrybut/id/index.html b/files/pl/mozilla/tech/xul/atrybut/id/index.html new file mode 100644 index 0000000000..f9fc9f811d --- /dev/null +++ b/files/pl/mozilla/tech/xul/atrybut/id/index.html @@ -0,0 +1,37 @@ +--- +title: id +slug: Mozilla/Tech/XUL/Atrybut/id +tags: + - Atrybuty_XUL + - Dokumentacja_XUL +translation_of: Archive/Mozilla/XUL/Attribute/id +--- +<div class="noinclude"><span class="breadcrumbs xulRefAttr_breadcrumbs">« <a href="/pl/docs/Dokumentacja_XUL">Dokumentacja XUL</a></span></div> +<dl><dt> <code id="a-id"><a href="https://developer.mozilla.org/pl/docs/Mozilla/Tech/XUL/Atrybut/id">id</a></code> +</dt><dd> Typ: <i>id elementu, musi być unikatowym identyfikatorem w oknie</i> +</dd><dd> Unikatowy identyfikator, który będzie identyfikował się z elementem. Możemy go zastosować jako parametr do <code><a href="pl/DOM/document.getElementById">getElementById()</a></code> i innych funkcji DOM oraz jako odniesienie do elementu w arkuszach stylu. </dd></dl> +<div class="noinclude"> +<h4 id="Przyk.C5.82ad" name="Przyk.C5.82ad">Przykład</h4> +<pre><button id="foo" label="Click Me" oncommand="doSomething()"/> + +<script> +function doSomething(){ + var myButton = document.getElementById('foo'); + myButton.setAttribute('label','The button was pressed'); +} +</script> +</pre> +<p>Więcej abstrakcyjnych wersji powyższego przykładu będzie: +</p> +<pre><button id="foo" label="Click Me" oncommand="setWidgetLabel(this, 'I was pressed')"/> +<script> +function setWidgetLabel(idName, newCaption){ + document.getElementById( idName.id ).setAttribute('label',newCaption) +} + +</script> +</pre> +<h4 id="Zobacz_tak.C5.BCe" name="Zobacz_tak.C5.BCe">Zobacz także</h4> +<p><code><code id="a-name"><a href="https://developer.mozilla.org/pl/docs/Mozilla/Tech/XUL/Atrybut/name">name</a></code></code> +</p> +</div> |
