字母e在js中属于数字,所以一般的正则匹配 \d 是拦不住字母e 的
正确写法为:
onKeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"