Disable the memory input of text boxes, such as input and textbox.

Source: Internet
Author: User

Disable auto completion and Input Method favorites in HTML

IE provides an Automatic completion function to remember the input content (such as the login account), so that you can quickly enter similar information next time. this is indeed a very friendly feature. during operation, you only need to double-click the text box or enter the first few characters. The system will automatically list the previous input history for you to choose from, this greatly improves the input speed and accuracy. I believe that most IE users have enabled this function.
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
<Form method = post action = "Submit. asp" AutoComplete = "off">
Disable Automatic completion of text box
<Input type = "text" name = "creditcard" maxlength = "16" AutoComplete = "off">
Disable Automatic completion in script
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:
<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 is the new content of the Textbox Control? 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 useful when it was first invented. However, with the enhancement of information security awareness, this function is sometimes not flattering, but rather annoying. Why? Nowadays, there are many opportunities for many people to share a computer at home, Internet cafes, and companies. However, the automation of textbox is also a cause, 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.

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.