正则匹配输入框数字、字母

只匹配数字及字母的正则

<input  type="text"

onkeyup="value=value.replace(/[^\a-\z\A-\Z0-9]/g,'')"

  />

只匹配纯数字的正则

<input  type="text"

onkeyup="this.value=this.value.replace(/[^0-9]+/g,'')"

  />

猜你喜欢

转载自www.cnblogs.com/jiajialove/p/10666255.html