function checkNum(e) { var re = /^\d+(?=\.{0,1}\d+$|$)/ if (e.value != "") { if (!re.test(e.value)) { alert("请输入正确的数字"); e.value = ""; e.focus(); } } ...
分类:
Web程序 时间:
2016-07-31 11:21:08
阅读次数:
193
整数或者小数:^[0-9]+\.{0,1}[0-9]{0,2}$只能输入数字:"^[0-9]*$"。只能输入n位的数字:"^\d{n}$"。只能输入至少n位的数字:"^\d{n,}$"。只能输入m~n位的数字:。"^\d{m,n}$"只能输入零和非零开头的数字:"^(0|[1-9][0-9]*)$" ...
分类:
Web程序 时间:
2016-07-31 00:22:18
阅读次数:
177
#define NUMBERS @"0123456789" #define ENGLISH @"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefjhigklmnopqrstuvwxyz" - (BOOL)textField:(UITextField*)textField should ...
分类:
移动开发 时间:
2016-07-22 14:29:35
阅读次数:
590
- (BOOL)validateNumber:(NSString*)number { BOOL res = YES; NSCharacterSet* tmpSet = [NSCharacterSet characterSetWithCharactersInString:@"0123456789."] ...
分类:
其他好文 时间:
2016-07-12 15:10:08
阅读次数:
105
JS控制字符,只能输入数字,只能输入中文,只能输入数字和英文,不能输入中文 ...
分类:
其他好文 时间:
2016-07-05 15:37:56
阅读次数:
165
有一个input输入框,只能输入数字。 如果是pc端没有问题 <input type="tel" maxlength="6" class="pwd-input" id="pwd-input" style="ime-mode:disabled;" onpaste="return false;" onk ...
分类:
移动开发 时间:
2016-07-04 18:26:28
阅读次数:
547
有时需要限制文本框输入内容的类型,本节分享下正则表达式限制文本框只能输入数字、小数点、英文字母、汉字等代码。 例如,输入大于0的正整数 复制代码代码如下: <input onkeyup="if(this.value.length==1){this.value=this.value.replace(/ ...
分类:
其他好文 时间:
2016-06-27 10:38:53
阅读次数:
178
private void txtSum_KeyPress(object sender, KeyPressEventArgs e) { if ((e.KeyChar != 8 && !char.IsDigit(e.KeyChar))&&e.KeyChar!=13) { MessageBox.Show( ...
分类:
其他好文 时间:
2016-06-22 09:11:53
阅读次数:
174