How to disable the highlights of text box memory functions

Source: Internet
Author: User

However, as a website developer, you do not want to remember all the information on your computer (such as your bank account and other important accounts and passwords ), however, we cannot require users to disable auto-completion. fortunately, IE5.0 adds an AUTOCOMPLETE attribute to controls such as INPUT type = password, INPUT type = text, FORM, and so on. To disable automatic function of controls, set AUTOCOMPLETE to off, for example:

Automatic completion of the entire form is prohibited

Copy codeThe Code is as follows:
<FORM method = post action = "submit. asp" AUTOCOMPLETE = "OFF">

Disable Automatic completion of text box

Copy codeThe Code is as follows:
<Input type = "text" name = "creditcard" maxlength = "16" AUTOCOMPLETE = "OFF">

Disable Automatic completion in script

Copy codeThe Code is as follows:
Function init ()
{
Element. setAttribute ("AutoComplete", "off ");
}

In addition, if you want to disable the text box from using the input method, you can add ime-mode: disabled to its style. However, Chinese characters cannot be entered, because you can still copy and paste Chinese characters. for example:

Copy codeThe Code is as follows:
<Input type = text style = "ime-mode: disabled;">

Microsoft's. net passport is implemented in this way, but there are other methods because the implementation methods in YAHOO and GMAIL are different.

What are the new content of the TextBox Control in. NET? Well! There is a small "improvement" That seems small but often brings troubles, that is, "AutoComplete ). What is automatic completion? That is, TextBox will remember the text that the user has input. When you enter the text again next time, related words will be automatically prompted. The most common is that the user will automatically bring out the account password when logging on to the website.

This function was very convenient and easy to use when it was first invented. However, with the enhancement of information security awareness, this function is sometimes not flattering, but rather annoying. Why? At present, whether at home, Internet cafes or companies, there are many opportunities for many people to share a computer, but it is also because of the automated completion of TextBox, it is not difficult for others to view your email or even log on to the webpage by using your account. After selecting your account in the TextBox, the password is usually automatically taken out.

My friends asked me how to solve this annoying problem. The AutoCompleteType attribute built in the TextBox Control of ASP. NET 2.0 can easily solve this problem. You only need to set the AutoCompleteType attribute of the TextBox to "Disable", and the prompt will not appear after it is automatically completed.

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.