Keyboard and Chinese input are not allowed but can be clicked

  • 2020-03-30 01:42:15
  • OfStack

The net found a lot of, not practical, not compatible problem, this can!
< Input> Forbidden keyboard and Chinese input, but can not use readonly and also need to be compatible with ie and ff, in order to complete this function took a lot of work, ha ha, in this record for future use; Onpaste ="return false"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">    
  <TITLE> New Document </TITLE>    
  //Style ="ime-mode:disabled" disables Chinese input & assistance;      
function noPermitInput(e){       
       var evt = window.event || e ;     
            evt.returnValue=false; //Ie prohibits keyboarding & NBSP;      
            evt.preventDefault(); //Fire fox forbids keyboarding & NBSP;      
function isIE() {     
    if (window.navigator.userAgent.toLowerCase().indexOf("msie") >= 1)     
        return true;     
        return false;     
   Keyboard key input and Chinese input are prohibited      
  <input type="text" value=""   style="ime-mode:disabled" onkeypress="noPermitInput(event)" >    

Related articles: