function showKeyPress(evt,obj) {
evt = (evt) ? evt : window.event
return checkSpecificKey(evt.keyCode,obj);
}
function checkSpecificKey(keyCode,obj) {
var reg = /[!@#$\%^&*<>\:\;~\,]/g ; //Specific Key list
var val = obj.value;
var flg = reg.test(val);
if(flg){
val = val.replace(reg,'')
console.log(val)
obj.value = val;
}
}
html: onkeyup ="return showKeyPress(event,this)" //输入时
onpaste ="return showKeyPress(event,this)" //粘贴时