diff options
Diffstat (limited to 'files/it/web/api/document/getelementsbyname/index.html')
| -rw-r--r-- | files/it/web/api/document/getelementsbyname/index.html | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/files/it/web/api/document/getelementsbyname/index.html b/files/it/web/api/document/getelementsbyname/index.html deleted file mode 100644 index f39fdf8ef7..0000000000 --- a/files/it/web/api/document/getelementsbyname/index.html +++ /dev/null @@ -1,97 +0,0 @@ ---- -title: Document.getElementsByName() -slug: Web/API/Document/getElementsByName -tags: - - API - - DOM - - Document - - HTML - - Referenza - - metodo -translation_of: Web/API/Document/getElementsByName ---- -<div>{{APIRef("DOM")}}</div> - -<p><span class="seoSummary">Il metodo <strong><code>getElementsByName()</code></strong> dell'oggetto {{domxref("Document")}} ritorna una raccolta di elementi {{domxref("NodeList")}} con un determinato {{domxref("element.name","name")}} nel documento.</span></p> - -<h2 id="Sintassi">Sintassi</h2> - -<pre class="syntaxbox">var <var>elements</var> = document.getElementsByName(<var>name</var>); -</pre> - -<ul> - <li><var>elements</var> è una {{domxref("NodeList")}} dinamica, il che significa che si aggiorna automaticamente man mano che nuovi elementi con lo stesso <code>name</code> vengono aggiunti / rimossi dal documento.</li> - <li><var>name</var> è il valore dell'attributo <code>name</code> degli elementi.</li> -</ul> - -<h2 id="Esempio">Esempio</h2> - -<pre class="brush:html"><!DOCTYPE html> -<html lang="en"> -<title>Example: using document.getElementsByName</title> - -<input type="hidden" name="up"> -<input type="hidden" name="down"> - -<script> - var up_names = document.getElementsByName("up"); - console.log(up_names[0].tagName); // ritorna "INPUT" -</script> -</html> -</pre> - -<h2 id="Appunti">Appunti</h2> - -<p>L'attributo {{domxref("element.name","name")}} può essere applicato solo nei documenti (X)HTML.</p> - -<p>La raccolta {{domxref("NodeList")}} restituita contiene tutti gli elementi con il parametro <code>name</code> dato, come {{htmlelement("meta")}}, {{htmlelement("object")}}, e persino elementi che non supportano affatto l'attributo <code>name</code>.</p> - -<div class="warning"> -<p>Il metodo <strong>getElementsByName</strong> funziona in modo diverso in IE10 e versioni precedenti. Lì, <code>getElementsByName()</code> restituisce anche gli elementi che hanno un <a href="/en-US/docs/Web/HTML/Global_attributes/id">attributo <code>id</code></a> con il valore specificato. Fai attenzione a non usare la stessa stringa sia di un <code>name</code> che di un <code>id</code>.</p> -</div> - -<div class="warning"> -<p>Il metodo <strong>getElementsByName</strong> funziona in modo diverso in IE. Lì, <code>getElementsByName()</code> non restituisce tutti gli elementi che potrebbero non avere un attributo <code>name</code> (come <code><span></code>).</p> -</div> - -<div class="warning"> -<p>Sia IE che Edge restituiscono una {{domxref("HTMLCollection")}}, non una {{domxref("NodeList")}}</p> -</div> - -<h2 id="Specifiche">Specifiche</h2> - -<table class="standard-table"> - <thead> - <tr> - <th scope="col">Specifica</th> - <th scope="col">Stato</th> - <th scope="col">Commento</th> - </tr> - </thead> - <tbody> - <tr> - <td>{{SpecName('HTML WHATWG', '#dom-document-getelementsbyname', "Document.getElementsByName()")}}</td> - <td>{{ Spec2('HTML WHATWG') }}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName("DOM2 HTML", "html.html#ID-71555259", "Document.getElementsByName()")}}</td> - <td>{{Spec2("DOM2 HTML")}}</td> - <td>Definizione iniziale</td> - </tr> - </tbody> -</table> - -<h2 id="Compatibilità_con_i_browser">Compatibilità con i browser</h2> - - - -<p>{{Compat("api.Document.getElementsByName")}}</p> - -<h2 id="Vedi_anche">Vedi anche</h2> - -<ul> - <li>{{domxref("document.getElementById()")}} per restituire un riferimento a un elemento tramite il suo <code>id</code> unico</li> - <li>{{domxref("document.getElementsByTagName()")}} per restituire riferimenti ad elementi con lo stesso <a href="https://developer.mozilla.org/it/docs/Web/API/Element/tagName">tag</a></li> - <li>{{domxref("document.querySelector()")}} per restituire riferimenti a elementi tramite selettori CSS come <code>'div.myclass'</code></li> -</ul> |
