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.