|
Geek-Tutorials.com
|
|
<Form> tag creates a client side user data input form in a html document. A form is used to pass client side user data input to a specified server. There can be several forms in a html document.
figure above shows a sample form without any form attributes.
Each form require an action attribute to specify the location to send the submitted data input and a method attribute to define a method of accessing the location defined in the action attribute either GET or POST.
< FORM ACTION="_URL_" METHOD="GET|POST">
<HTML> <BODY>
<FORM>
<H4>First Name<input type="text" size="20" name="FN"></H4>
<H4>Last Name<input type="text" size="20" name="LN"></H4>
</FORM>
</BODY> </HTML>
| enctype | <FORM ENCTYPE = MIME TYPE ..... > | specifies the media type used to encode the content of the form. |
| method | <FORM METHOD = get| post..... > | specifies the method of accessing the URL defined in ACTION form attribute with the following values: get - the form data is appended to the action URL when submitted. post - the form data is send through the HTTP post transaction when submitted. |
| name | <FORM NAME = form_name.......> | assign a name to the form. |
| target | <FORM TARGET =_blank| _self| parent| top..... > | specifies what window is used to load the the form feedback at the target URL defined in the form action attribute. _blank - load the form feedback page in a new window. |
| Core Attributes | class, id, style, title. |
| Internationalization Attributes | lang, dir. |
| Event Attributes | onsubmit, onreset, onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup |
| Attribute | Syntax | Description |
| CLASS | eg. an element's class : eg. multiple classes in an element :
|
An element can belong to multiple classes. Attribute value for CLASS is space-separated list of class names. Begin with a letter range from A-Z or a-z and may be followed by letters (A-Za-z), digits (0-9), hyphens ("-"), underscores ("_"), colons (":"), and periods ("."). The value is case-sensitive. |
| ID | <ELEMENT ID = stID... > | A unique id for an element. stID = a string which specifies attribute value for ID Attribute value for ID begin with a letter range from A-Z or a-z and may be followed by letters (A-Za-z), digits (0-9), hyphens ("-"), underscores ("_"), colons (":"), and periods ("."). The value is case-sensitive. |
| STYLE | <ELEMENT STYLE = stStyle ... > | Specify an inline style for the element. Common Usage : to associate a particular style sheet rule for the element. stStyle = a string to specifies the inline style type. Attribute value for STYLE is the type of the style sheet language or style rules. |
| TITLE | <ELEMENT TITLE = stTitle... > | Specify the title for the element. Common Usage : as a tooltip to retrieve advisory information when user hover the mouse over the object. stTitle = a string that specifies the title attribute value. Attribute value for TITLE is space/non space-separated list of text. |
| Attribute | Syntax | Description |
| DIR | <ELEMENT DIR = stDir... > | Sets the text direction stDir = attribute value for DIR Attribute value for DIR is the directionality of text from left-to-right (DIR=ltr, the default) or right-to-left (DIR=rtl). |
| LANG | <ELEMENT LANG = stLang... > | Sets the language code stLang = attribute value for LANG Attribute value for LANG is non space-separated, case-insensitive with the following values : (LANG=en) for English, (LANG=ja) for Japanese and etc. |
| Attribute | Description |
| onSubmit | when the form is submitted.. |
| onReset | when the form is reset. |
| onClick | the mouse button is clicked on an element. |
| onDblClick | the mouse button is double-clicked on an element. |
| onMousedown | the mouse button is pressed over an element. |
| onMouseup | the mouse button is released over an element. |
| onMouseover | the mouse is moved onto an element. |
| onMousemove | the mouse is moved while over an element. |
| onMouseout | the mouse is moved away from an element. |
| onKeypress | a key is pressed and released over an element. |
| onKeydown | a key is pressed down over an element. |
| onKeyup | a key is released over an element. |