aboutsummaryrefslogtreecommitdiff
path: root/files/it/web/api/document/forms/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/it/web/api/document/forms/index.html')
-rw-r--r--files/it/web/api/document/forms/index.html128
1 files changed, 128 insertions, 0 deletions
diff --git a/files/it/web/api/document/forms/index.html b/files/it/web/api/document/forms/index.html
new file mode 100644
index 0000000000..cda3146a42
--- /dev/null
+++ b/files/it/web/api/document/forms/index.html
@@ -0,0 +1,128 @@
+---
+title: Document.forms
+slug: Web/API/Document/forms
+tags:
+ - API
+ - DOM
+ - Document
+ - Forms
+ - HTML DOM
+ - HTML forms
+ - Proprietà
+ - Referenza
+translation_of: Web/API/Document/forms
+---
+<p><span class="seoSummary">La proprietà di sola lettura <strong><code>forms</code></strong> dell'interfaccia {{domxref("Document")}} restituisce una {{domxref("HTMLCollection")}} che elenca tutti gli elementi {{HTMLElement("form")}} contenuti nel documento.</span></p>
+
+<div class="note">
+<p><strong>Note:</strong> Allo stesso modo, è possibile accedere a un elenco di elementi di input utente di un modulo utilizzando la proprietà {{domxref("HTMLFormElement.elements")}}.</p>
+</div>
+
+<h2 id="Syntax" name="Syntax">Sintassi</h2>
+
+<pre class="syntaxbox"><var>collection</var> = <em>document</em>.forms;</pre>
+
+<h3 id="Valore">Valore</h3>
+
+<p>Un oggetto {{domxref("HTMLCollection")}} che elenca tutti i form del documento. Ogni elemento della collezione è un {{domxref("HTMLFormElement")}} che rappresenta un singolo elemento <code>&lt;form&gt;</code>.</p>
+
+<p>Se il documento non ha moduli, la raccolta restituita è vuota, con una lunghezza pari a zero.</p>
+
+<h2 id="Example" name="Example">Esempi</h2>
+
+<h3 id="Ottenere_informazioni_sul_modulo">Ottenere informazioni sul modulo</h3>
+
+<pre class="brush:html">&lt;!DOCTYPE html&gt;
+&lt;html lang="en"&gt;
+
+&lt;head&gt;
+&lt;title&gt;document.forms example&lt;/title&gt;
+&lt;/head&gt;
+
+&lt;body&gt;
+
+&lt;form id="robby"&gt;
+ &lt;input type="button" onclick="alert(document.forms[0].id);" value="robby's form" /&gt;
+&lt;/form&gt;
+
+&lt;form id="dave"&gt;
+ &lt;input type="button" onclick="alert(document.forms[1].id);" value="dave's form" /&gt;
+&lt;/form&gt;
+
+&lt;form id="paul"&gt;
+ &lt;input type="button" onclick="alert(document.forms[2].id);" value="paul's form" /&gt;
+&lt;/form&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
+</pre>
+
+<h3 id="Ottenere_un_elemento_all'interno_di_un_modulo">Ottenere un elemento all'interno di un modulo</h3>
+
+<pre class="brush: js">var selectForm = document.forms[index];
+var selectFormElement = document.forms[index].elements[index];
+</pre>
+
+<h3 id="Accesso_al_modulo_con_nome">Accesso al modulo con nome</h3>
+
+<pre class="brush: html">&lt;!DOCTYPE html&gt;
+&lt;html lang="en"&gt;
+&lt;head&gt;
+ &lt;title&gt;document.forms example&lt;/title&gt;
+&lt;/head&gt;
+
+&lt;body&gt;
+
+&lt;form name="login"&gt;
+ &lt;input name="email" type="email"&gt;
+  &lt;input name="password" type="password"&gt;
+  &lt;button type="submit"&gt;Log in&lt;/button&gt;
+&lt;/form&gt;
+
+&lt;script&gt;
+ var loginForm = document.forms.login; // Or document.forms['login']
+  loginForm.elements.email.placeholder = 'test@example.com';
+  loginForm.elements.password.placeholder = 'password';
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
+</pre>
+
+<h2 id="Specifications" name="Specifications">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-forms', 'Document.forms')}}</td>
+ <td>{{ Spec2('HTML WHATWG') }}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('DOM2 HTML', 'html.html#ID-1689064', 'Document.forms')}}</td>
+ <td>{{ Spec2('DOM2 Events') }}</td>
+ <td>Definizione iniziale.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="See_Also" name="See_Also">Compatibilità con i browser</h2>
+
+
+
+<p>{{Compat("api.Document.forms")}}</p>
+
+<h2 id="See_Also" name="See_Also">Vedi anche</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Learn/HTML/Forms">HTML forms</a></li>
+ <li>{{HTMLElement("form")}} e l'interfaccia {{domxref("HTMLFormElement")}}</li>
+</ul>
+
+<div>{{APIRef("DOM")}}</div>