How to prevent the memory function of a text box collection _ Practical Tips

Source: Internet
Author: User

However, as a website developer, it is not desirable to have any information on the user's computer (such as bank accounts and other important accounts and passwords), but we can not ask users to disable the automatic completion of the function. Fortunately after IE5.0 for the input type=password, input type=text, FORM and other controls to add a AutoComplete properties, to prevent the control automatically complete function, just the AutoComplete set to off, such as:

The entire form prevents automatic completion

Copy Code code as follows:

<form method=post action= "submit.asp" autocomplete= "Off" >

Prevent text boxes from completing automatically

Copy Code code as follows:

<input type= "text" name= "CreditCard" maxlength= "" "autocomplete=" Off ">

Disable automatic completion in script

Copy Code code as follows:

function init ()
{
Element.setattribute ("AutoComplete", "off");
}

In addition, if you want to prevent text boxes from using Input method, you can add ime-mode:disabled to its style, but this does not prevent the input of Chinese characters, because the user can still copy and paste input characters.

Copy Code code as follows:

<input type=text style= "ime-mode:disabled; ">

This is how Microsoft's. NET PASSPORT is implemented, but there are other ways to do it, because the way in which Yahoo and Gmail are implemented is different.

. What's new in the TextBox controls in net? Well! There is a seemingly small but often disturbing small "improvement" is "automatic Completion" (AutoComplete). What is automatic completion? That is, the textbox will remember the user has entered the text, when the next input will automatically prompt the relevant words, the most common is the user login site will automatically bring out the account password.

This function was first invented when we feel very convenient and easy to use, but with the strengthening of information security awareness, this function is sometimes not pleasing, but a bit disgusting, why? Now whether it is at home, internet cafes or companies, many people share a computer a lot of opportunities, but also because of the automatic completion of the textbox in the cause of trouble, others want to see your e-mail even under the guise of your account login page is not difficult, as long as in the TextBox select your account, Passwords are usually brought out automatically together.

About the annoying question, I was asked by my friends how to solve it. The AutoCompleteType property built into the TextBox control in ASP.net 2.0 can easily solve this problem, and the automatic completion prompt will not appear if the TextBox's AutoCompleteType is set to "Disable".

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.