码迷,mamicode.com
首页 > 其他好文 > 详细

验证码 禁止输入中文

时间:2015-11-12 13:24:08      阅读:240      评论:0      收藏:0      [点我收藏+]

标签:

方法一:禁止中文输入法

<input type="text" style="ime-mode:disabled">

方法二:禁止黏贴,禁止拖拽,禁止中文输入法!

这种方法是最强的禁止 中文输入

<input type="text" onpaste="return false" ondragenter="return false" oncontextmenu="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;

验证码 禁止输入中文

标签:

原文地址:http://www.cnblogs.com/louby/p/4958419.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!