怎么用正则表达式限制输入框输入数字的范围(数字范围是50-1000),怎么限制输入框输入的数字是以9506开头的

转自 https://zhidao.baidu.com/question/1829801257322895700.html

<input type="text" onkeyup="var v=this.value||'';v=v.replace(/[^\d]/g,'');v=parseInt(v,10);if(v<50){this.value=50;}else if(v>1000){this.value=1000;}">



<input type="text" onkeyup="var v=this.value||'';if(v.length>4&&!/^9506/.test(v)){this.value='';}">

猜你喜欢

转载自www.cnblogs.com/sulanlan/p/9941352.html
今日推荐