In JS, the input form hides the field and its usage, and the jsinput form

Source: Internet
Author: User

In JS, the input form hides the field and its usage, and the jsinput form

1. Form hidden fields

Hidden domains are invisible elements used to collect or send information. For webpage visitors, hidden domains are invisible. When a form is submitted, the hidden field will send the information to the server with the name and value you set.

Code Format:

<input type="hidden" name="..." value="...">

Attribute explanation:

Type = "hidden" defines hidden fields;

The name attribute defines the name of the hidden domain. To accurately collect data, you must define a unique name;

The value Attribute defines the value of the hidden field.

For example:

<input type=”hidden” name=”ExPws” value=”dd”>

In fact, to put it bluntly, the hidden domain is not visible at the front-end, just like the elements in the form. There is a value in the name, but the data submitted is invisible.

Ii. Use of hidden Domains

Hide the use of the field, that is, from the table value ID value, or other variable values, but not displayed on the page, and then submitted to a new page, through the request. form ("name of hidden domain name.

Example:

1、<input type=hidden name=coun value=<%=cc%>The hidden domain name here is coun and the value is<%=cc%>In the preceding example, if cc = 100, the value is 100;

2. submit the form to the new page xx. asp;

3. On the xx. asp page, userequest.write request.form(“coun”), The value displayed on the page is 100

To put it simply, you want to extract some information from the previous page, but these things that cannot be displayed on the previous page use a hidden domain.

Iii. Role of hidden Domains

1. The hidden field is invisible to users on the page. The purpose of inserting a hidden field in a form is to collect or send information to facilitate the use of the form processing program. When a viewer clicks the send button to send a form, information about hidden fields is also sent to the server.

2. Sometimes we need to give the user a message so that the user can submit the form to determine the user identity, such as sessionkey. of course, these things can also be implemented using cookies, but it is much easier to use hidden domains. there will be no browsers that do not support it, and users will be troubled by disabling cookies.

3. Sometimes there are multiple submission buttons in a form. How can I make the program clearly know that the user submitted the form by that button? We can write a hidden domain, and then addonclick=”document.form.command.value=”xx”“After receiving the data, we first check the value of command to know that the user submitted the data by clicking the button.

4. Sometimes a webpage has multiple forms. We know that multiple forms cannot be submitted at the same time, but sometimes these forms do interact with each other, we can add hidden fields to form to associate them.

5 javascript does not support global variables, but sometimes we have to use global variables, so that we can first store the value in a hidden field and its value will not be lost.

6. For example, if you press a button to bring up four small windows, the other three are automatically closed when you click a small window. however, IE does not support mutual calls between small windows. Therefore, you only need to write a hidden field in the parent window. When the value of the hidden field in the small window is close, you can turn it off.

The above section describes the hidden fields of input forms in JavaScript and their usage methods. I hope this will be helpful to you. If you have any questions, please leave a message for me, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!

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.