问题描述
如:13456789098,13567890987,
解决方案
解决方案二:
是验证吗?
解决方案三:
循环判断吧
解决方案四:
用js来判断吧,每11个数字就加逗号咯。输入一次就检查一次(也就是引发事件)
解决方案五:
js吧change事件
解决方案六:
for循环定义一个i循环一次加一是11的倍数就在结尾加个逗号
解决方案七:
这个貌似只能js吧
解决方案八:
你是不是在做手机号选号一类的网站呀?我曾经做了一个你可以把你的思路说出来我帮着你参谋一下
解决方案九:
正则表达式!
解决方案十:
给输入框加onchange事件基本思路如下:在onchange事件的方法中判断输入框内容的长度(用split去掉逗号)如果能被11整除,则将输入框的内容加上逗号即可。
解决方案十一:
textbox的onpropertychange时候用正则表达式验证
解决方案十二:
用正则验证验证,验证通过后拼接一个,号
解决方案十三:
我也觉得这样好引用9楼liuyang509的回复:
给输入框加onchange事件基本思路如下:在onchange事件的方法中判断输入框内容的长度(用split去掉逗号)如果能被11整除,则将输入框的内容加上逗号即可。
解决方案十四:
publicstaticboolIsValidMobileNo(stringMobileNo){stringregPattern=@"^1(3[0-9]|5[0-35-9]|8[025-9])\d{8}$";returnRegex.IsMatch(MobileNo,regPattern);}stringTel=This.TextBox1.Text.Trim().ToString;boolisTelephone=IsValidMobileNo(Tel);if(isTelephone){Tel=Tel+",";}当然需要循环else{}
解决方案十五:
functioncheckMobile(){varsMobile=document.mobileform.mobile.valueif(!(/^1[3|4|5|8][0-9]d{4,8}$/.test(sMobile))){alert("不是完整的11位手机号或者正确的手机号前七位");document.mobileform.mobile.focus();returnfalse;}}这是一个手机号的正则,在这个手机号后面加上,应该可以的吧,具体你试试看吧!
解决方案:
<inputid="Text1"type="text"style="width:300px;"onkeyup="Validate(this)"/><scripttype="text/javascript">functionValidate(obj){obj.value=obj.value.replace(/(d{11}(?!,))+/g,"$1,");}</script>
解决方案:
JS的onkeyup事件
解决方案:
http://nbtcnet.com/blog/7/%E5%A6%82%E4%BD%95%E5%88%B6%E4%BD%9C%E4%B8%80%E4%B8%AA%E5%B8%A6%E9%80%97%E5%8F%B7%E7%9A%84%E9%87%91%E9%A2%9D%E8%BE%93%E5%85%A5%E6%A1%86这个是金额的和你的要求类似,希望能帮到你。
解决方案:
jsonkeypress="this.value=this.value.replace(/(d{11}(?!,))+/g,"$1,");"
解决方案:
$(function(){$("#name").keyup(function(){vartest=$(this).val();if(test.trim().length<12){if(test.trim().length>10){$(this).val(test+',');}else{$(this).val(test);}}else{vararr=test.split(',');vartxtArr='';for(vari=0;i<arr.length;i++){if(arr[i].length>10){txtArr+=arr[i]+',';}else{txtArr+=arr[i];}}$(this).val(txtArr);}});});
解决方案:
用JS给输入框架chang事件
解决方案:
解决方案:
://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]
解决方案:
解决方案:
js的keyup事件用用就可以了,怎么加逗号完全没问题,问题就在于如果输入的11位数字不符合手机规则时,要如何处理
解决方案:
试试这个:
解决方案:
我就会笨方法呵呵
解决方案:
引用24楼starfd的回复:
js的keyup事件用用就可以了,怎么加逗号完全没问题,问题就在于如果输入的11位数字不符合手机规则时,要如何处理
那就只能写正则了