Copyright © tutorialspoint.com
The HTML <form> tag is used for creating a form for user input. A form can contain textfields, checkboxes, radio-buttons and more. Forms are used to pass user-data to a specified URL.
NONE
<form action="/cgi-bin/hello_get.cgi" method="get"> First name: <input type="text" name="first_name" value="" maxlength="100" /> <br /> Last name: <input type="text" name="last_name" value="" maxlength="100" /> <input type="submit" value="Submit" /> </form> |
This will produce following result:
To Become more comfortable - Do Online Practice
| Attribute | Value | Description |
|---|---|---|
| action | URL | Specifies a URI/URL of the back-end script that will process the form. |
| accept | content types | Specifies a comma-separated list of content types that the server accepts. |
| accept-charset | charset list | Specifies a list of character encodings that the server accepts. The default value is "unknown". |
| enctype | mimetypes | The mime type used to encode the content of the form. |
| method | get post | Specifies the HTTP method to use when the form is submitted. Possible values:
|
| name | from name | Defines a unique name for the form |
| target | _blank _self _parent _top | Target to open the given URL.
|
| Attribute | Description |
|---|---|
| class | Document wide identifier |
| dir | Specifies the direction of the text |
| id | Document wide identifier |
| title | Specifies a title to associate with the element. |
| style | Helps to include inline casecadubf style sheet. |
| lang | Sets the language code. |
| Attribute | Description |
|---|---|
| onclick | Script runs when a mouse click |
| ondblclick | Script runs when a mouse double-click |
| onmousedown | Script runs when mouse button is pressed |
| onmouseup | Script runs when mouse button is released |
| onmouseover | Script runs when mouse pointer moves over an element |
| onmousemove | Script runs when mouse pointer moves |
| onmouseout | Script runs when mouse pointer moves out of an element |
| onkeypress | Script runs when key is pressed and released |
| onkeydown | Script runs when key is pressed |
| onkeyup | Script runs when key is released |
| onsubmit | Script runs when from is submitted |
| onreset | Script runs when from is reset |
Copyright © tutorialspoint.com