Home >Web Front-end >JS Tutorial >Input prohibits keyboard and Chinese input, but can be clicked_javascript skills

Input prohibits keyboard and Chinese input, but can be clicked_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:00:131763browse

I searched a lot online, but it’s not practical or has compatibility issues. This one works!
Keyboard and Chinese input are prohibited, but readonly cannot be used and it must be compatible with ie and ff. It took a lot of effort to complete this function, haha, record it here for future use; in addition, pasting onpaste is prohibited ="return false"

Copy code The code is as follows:




New Document ;
// Style style="ime-mode:disabled" disables Chinese input
function noPermitInput(e){
var evt = window.event || e ;
if(isIE()) {                  evt.returnValue=false; //                                                                                                    evt.returnValue=false;                                                                       isIE() {                                                                                                                



Disable keyboard key input and Chinese input




Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn