Keyboard and Chinese input are not allowed, but click _ javascript

Source: Internet
Author: User
This article mainly introduces & lt; input & gt; prohibiting keyboard and Chinese input, but you can click. If you need a friend, please refer to it. I hope you can find a lot of help on the Internet, which is not practical or incompatible. This is fine!
Keyboard and Chinese input are prohibited, but readonly is not available and must be compatible with ie and ff. It takes a lot of effort to complete this function; in addition, do not paste onpaste = "return false"

The Code is as follows:





New Document
Script
// Style = "ime-mode: disabled" Disable Chinese Input
Function noPermitInput (e ){
Var evt = window. event | e;
If (isIE ()){
Evt. returnValue = false; // disable keyboard input in ie
} Else {
Evt. preventDefault (); // fire fox disables keyboard input
}
}
Function isIE (){
If (window. navigator. userAgent. toLowerCase (). indexOf ("msie")> = 1)
Return true;
Else
Return false;
}
Script


Disable keyboard and Chinese Input


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.