控制 input框只输入数字

在input标签中添加  

onkeyup="this.value=this.value.replace(/[^\d]/g,'')"



    r1= /^[A-Za-z]+$/,//大小写的英文
r2=/^[0-9]+$/,///数字
r3=/^[\u4e00-\u9fa5]+$/,//汉字
r4=/^[A-Za-z0-9\u4e00-\u9fa5]+$/,//数字、英文和汉子

猜你喜欢

转载自www.cnblogs.com/chenlongsheng/p/11132148.html