检查这个。在email field
它甚至不接受单次击键时。据我所知,在AllowRegex
变量处存在错误,无法验证我在表单中的电子邮件字段中输入的内容..
function mailonly(e) {
var code;
if (!e) var e = window.event;
if (e.keyCode) code = e.keyCode;
else if (e.which) code = e.which;
var character = String.fromCharCode(code);
var AllowRegex = /^[\ba-zA-Z0-9\s-._ ]+@[a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,4}$/;
if (AllowRegex.test(character))
return true;
return false;
}