控制 input框只输入数字

在input标签中添加  

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



    r1= /^[A-Za-z]+$/,//大小写的英文
r2=/^[0-9]+$/,///数字
r3=/^[u4e00-u9fa5]+$/,//汉字
r4=/^[A-Za-z0-9u4e00-u9fa5]+$/,//数字、英文和汉子
原文地址:https://www.cnblogs.com/chenlongsheng/p/11132148.html