+ Notes to add HTML5 Forms

input tag

 type = "image" and type = "submit" property    differences     ( hereinafter abbreviated image and submit)

1. Both can respond to requests;

2. The difference is that when the method = "GET"  when, when the mouse clicks when Image , in addition to the normal request URL, but also the focal point coordinates of the mouse click on the picture (note:

The focal point coordinates are relative to click on the picture to say) as a parameter appears in the url inside. http://passport.cnblogs.com/login.aspx?uname=%D5%C5%C8%FD&pwd=123& X = 168 Y = 21 is &

 

 

Read-only form and disabled property

1. Read-only: the server side does not want the user to modify the data, but requires the data displayed in the form. Such as registration or trade agreements, and other commodity prices.

2. Disable: Only certain conditions are met in order to use a feature. For example, only allow the user agrees to the registration agreement before clicking "Register" button. Player space can then click the "play" button during playback and other status.

 

 

label label

The label element does not present any special style to the user. If the user clicks the text within the label element, it will switch to control itself.

<label> for a tag property value should be equal to the relevant elements id attribute value, so as to bundle them together.

Examples

<form>

<label for="male">男</label>

<input type="radio" name="sex" id="male" />

<br />

<label for="female">女</label>

<input type="radio" name="sex" id="female" />

</form>

Explanation:

Click the button man will choose men, women will choose to click on the button woman

 

 

 

get post difference

Accept user input form is used, and the user input to "name = value value " as a collection submitted to the server for processing .

Forms form of some properties

The only form of identification: 1, id

 

2, name: name of the form

 

3, method: method definition form submission, there are two methods: Post and Get methods Methods

 

4, action: the page server for processing the form (expressed in URL form)

 

A form of control has two properties are very important: name attribute and value properties , these two attributes each control would constitute a "name-value pair" submitted to the page action attribute defined processing

 

 

Form submission post method, the data submitted to the server in the form of data blocks , form data does not appear in the browser UR L in, the form data in this way is safe . If the form is similar to passwords and other data contained in the data, it is recommended to use the post method.

 

 

Get method is to send the form data is the default method , this method will " ? NAME1 = value1 & NAME2 = value2 form", form data appended back to the browser in the URL, submitted to the server processing, this approach security than say post method, form data can be exposed as the URL, but its high processing efficiency than the post method . If the data in the form of no privacy data, we recommend using the get method, the higher its efficiency.

 

to sum up:

GET : less than the amount of data submitted to 1024 bytes, the form is submitted form field values (information request form: account number, password ... ) displayed in the address bar.

 

 

 

HTML <form> enctype attribute tag

Examples

In the following example, the form data is in an uncoded transmission case of:

<form action="form_action.asp" enctype="text/plain">

  <p>First name: <input type="text" name="fname" /></p>

  <p>Last name: <input type="text" name="lname" /></p>

  <input type="submit" value="Submit" />

</form>

Definition and Usage

enctype attribute specifies before being sent to the server should be how to encode the form data .

By default, data is encoded to form "file application / X-WWW-form-urlencoded" . That is, before being sent to the server, all the characters in encoding ( converting spaces to "+" plus, special symbols into ASCII HEX value ).

grammar

<form enctype="value">

Property Value

value

description

application/x-www-form-urlencoded

Coding all the characters (default) before sending

multipart/form-data

Not the character encoding.

When using the form contains file upload control, you must use this value.

text/plain

Spaces converted to "+" plus, but not a special character encoding.

 

 

 

of

Guess you like

Origin www.cnblogs.com/expedition/p/11183623.html