[Javascript] form, javascript form

Source: Internet
Author: User

[Javascript] form, javascript form

A form is an interactive operation method provided in a webpage. It consists of two parts: a form described in HTML source code, which can be directly inserted into the webpage; second, form processing after submission. You need to call the script compiled by the server to respond to the information submitted by the client. In HTML, you only need to insert the form tag <form> </form> to insert the form into the webpage. Some attributes of the form tag are as follows:

Attribute

Description

Name

Set form name

Method

Set the form sending method, which can be "post" or "get"

Action

Set form handlers

Enctype

Set the form encoding method

Target

Set the display target of the form

I. Information Input

Information Input is the main content of form operations. The user enters necessary information in the Form Control, sends it to the server for a response, and then the server returns the processing result to the user. <Input> is a commonly used mark of input information in a form. Its basic syntax is:

<form action=""><input name="" type=""/></form>

In the <input> tag, the name attribute is used to display the control name, And the type attribute is used to set the type of the inserted control. The following types of controls are available:

1. Text Control

1) text box -- text

<Input> set the value of the marked type attribute to text to insert a single row text box in the form. The entered information is displayed in a single row in the text box.

2) password box-password

<Input> set the value of the marked type attribute to password to insert the password box in the form. The entered content in the password box will be displayed as a small dot

3) text Domain -- textarea

Insert a text field in the form. You only need to insert the paired text field tag <textarea> </textarea>. Text fields can be used to input multiple lines of text and line breaks are allowed

2. Button

1) check box -- checkbox

<Input> set the value of the marked type attribute to checkbox to insert the check box in the form. The id is an optional box.

2) Single-choice button -- radio

<Input> set the type attribute value to radio to insert the single-choice button in the form. In the selected status, there is a small dot in the center of the button

3) Standard button-button

<Input> set the value of the marked type attribute to button to insert the standard button in the form. The value of "value" in the button is the name of the button displayed on the interface.

4) submit button -- submit

<Input> set the value of the marked type attribute to submit to insert the submit button in the form. When the user needs to submit information after filling out the form, use the submit button in the form to submit

5) reset button -- reset

<Input> set the type attribute value to reset to insert the reset button in the form. When you are not satisfied with the information you have entered, you can use the reset button to re-enter the information.

3. Other controls

1) file domain-file

<Input> when the value of the marked type attribute is set to file, the file fields in the form can be inserted. You can add the entire file in the file domain.

2) Hide the domain-hidden

Hidden fields are invisible to users in webpages. When a user submits a form, information in the hidden fields is also submitted. In the <input> tag, set the type property value to hidden to insert a hidden field in the form.

3) drop-down menu <select> and list box <option>

Insert the drop-down list in the form. You only need to insert a pair of <select> </select> with nested <option>. Basic Syntax:

<form action=""><select name="" size=""><option value=""><option value="">…</select></form>

Ii. Form Verification

Form Verification generally refers to the use of regular expressions to restrict the content in the control. The limitations on regular expressions have been mentioned in previous blogs.ASP.net verification control, The js file is too long, you can download the http://pan.baidu.com/s/1jGkr5RK here

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.