HTML CSS examples for HTML Tag:form
The name attribute sets the name of a form which is used to reference elements in a JavaScript, or to reference form data after a form is submitted.
Value | Description |
---|---|
text | Specifies the name of the form |
An HTML form with a name attribute:
<!DOCTYPE html> <html> <head> <script> function formSubmit() {<!-- ww w . j a v a2 s .co m--> document.forms["myForm"].submit(); } </script> </head> <body> <form name="myForm" action="/action_page.php" method="get"> First name: <input type="text" name="fname"><br> Last name: <input type="text" name="lname"><br><br> <input type="button" onclick="formSubmit()" value="Send form data!"> </form> </body> </html>