标签:
function showKeyPress(evt) {
evt = (evt) ? evt : window.event
return checkSpecificKey(evt.keyCode);
}
function checkSpecificKey(keyCode) {
var specialKey = "#$%\^*\‘\"\+<>\?\\:\/";//Specific Key list
var realkey = String.fromCharCode(keyCode);
var flg = false;
flg = (specialKey.indexOf(realkey) >= 0);
if (flg) {
alert(‘请勿输入特殊字符: ‘ + realkey);
return false;
}
return true;
}
document.onkeypress = showKeyPress;
标签:
原文地址:http://www.cnblogs.com/xwchengc/p/4597221.html