正则表达式格式验证

来源:互联网 发布:通达oa mysql 密码 编辑:程序博客网 时间:2024/05/17 03:45

呃,以后再添加。。。发现要用到的情况实在是多

1、纯数字

2、判断非数,主要是用来验证金额。

<input type="text" onafterpaste="this.value=this.value.replace(/\D/g,'')" onkeyup="this.value=this.value.replace(/\D/g,'')"  /><input type="text" onafterpaste="if (isNaN(this.value)) {alert('非法输入');this.value = '';}"  onkeyup="if (isNaN(this.value)) {alert('非法输入');this.value = '';}"  />