How do I use the HTML form tag Name property? The Name property of the form tag is detailed

Source: Internet
Author: User
Tags html form tag name
This article mainly introduces the use of the name attribute of the HTML form tag, and finally the difference between name and ID, which is described in this article as a description of the advantages of the name tag, let's take a look at this article now

Let's start by looking at the Name property usage of the HTML form tag:

The Name property in the form is mainly tagged with the form, just like each of us has a name, and when the form has a name, we can use the Request.Form ("name") method to get the data in the form form when we make the Dynamic Web page design!

Look at the example of the form tag Name property:

HTML form with the name attribute:

<form action= "form_action.asp" method= "Get" name= "MyForm" >  <p> Please enter username: <input type= "text" Name= " FName "/></p>  <p> re-enter user name: <input type=" text "name=" lname "/></p> <input type=  " Button "onclick=" Formsubmit () "value=" OK to commit "/></form>

Effect:

The Name property of the form label describes:

1.name property If [], when submitting a form, multiple name values are automatically made into an array submission

The 2.size property is represented by two properties, one of which is the width of the type for text and password,size as visible content, and the other type of input box that behaves as the width of the field in pixels; common usage:

<p>pin:<input type= "text" name= "PIN" maxlength= "2" size= "2"/></p>

Direct layout with MaxLength with the Size property

3. Note that the Size property has compatibility issues, generally do not use, as far as possible to use CSS to control the input width

The following describes the common name property and seldom uses the id attribute:(the difference between name and ID, the advantage of name)

The Name property of the form label was originally intended for identification purposes, but it is now recommended that an ID be used to identify the element according to the specification. But name cannot be substituted for the following purposes:

1. The control name of the form (form), and the submitted data is controlled by the control's name instead of the ID. Because there are many name that correspond to multiple controls at the same time, such as checkbox and radio, the ID must be unique in the full-text file. In addition, the browser sets the request sent to the server according to the name. Therefore, if the ID is used, the server cannot get the data.

The name of the 2.frame and window for specifying target in another frame or window.

The following are common, but it is strongly recommended that you do not use the name attribute with ID:

Anchor points, usually previously written

<a name= "MyName" >

It is now possible to specify with any element ID:

<div id= "myID" >

Okay, here's the description of the Name property of the HTML form tag, and the question can be asked below.

Related Article

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.