English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Das name-Attribut bestimmt den Namen des Formulars. Das name-Attribut wird verwendet, um Elemente in JavaScript zu referenzieren oder die Daten des Formulars nach dem Absenden des Formulars zu referenzieren.
HTML-Formulare mit dem name-Attribut:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>HTML <form> name Attribut verwenden-Grundlagen-Tutorial(oldtoolbag.com)</title> <script> function formSubmit() { document.forms["myForm"].submit(); } </script> </head> <body> <form name="myForm" action="action_page.php" method="get"> Vorname: <input type="text" name="fname"><br> Nachname: <input type="text" name="lname"><br><br> <input type="button" onclick="formSubmit()" value="Send form data!"> </form> <p>Notice that the JavaScript in the header uses the form's name to specify the form to be submitted.</p> </body> </html>Test to see ‹/›
IEFirefoxOperaChromeSafari
All major browsers support the name attribute.
The name attribute specifies the name of the form.
The name attribute is used to reference elements in JavaScript, or to reference form data after submitting the form.
None.
In XHTML, the name attribute is deprecated. Please use the id attribute instead.
<form name="text">
Value | Description |
---|---|
text | Specifies the name of the form. |