验证码 禁止输入中文
生活随笔
收集整理的這篇文章主要介紹了
验证码 禁止输入中文
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
方法一:禁止中文輸入法
<input type="text" style="ime-mode:disabled">
方法二:禁止黏貼,禁止拖拽,禁止中文輸入法!
這種方法是最強的禁止 中文輸入
<input type="text" οnpaste="return false" οndragenter="return false" οncοntextmenu="return false;" style="ime-mode:disabled"/>
?
獲取鍵盤按下值
function keyUp(e) {
var currKey = 0, e = e || event;
currKey = e.keyCode || e.which || e.charCode;
var keyName = String.fromCharCode(currKey);
//alert("按鍵碼: " + currKey + " 字符: " + keyName);
}
document.onkeyup = keyUp;
轉載于:https://www.cnblogs.com/louby/p/4958419.html
總結
以上是生活随笔為你收集整理的验证码 禁止输入中文的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: android学习笔记Fragment的
- 下一篇: webstorm基础使用总结