using System; using System.Text.RegularExpressions; namespace MetarCommonSupport { /// <summary> /// 通过Framwork类库中的Regex类实现了一些特殊功能数据检查 /// </summary> public class MetarnetRegex { private static MetarnetRegex instance = null; public static Meta
/判断输入内容是否为空 function IsNull(){ var str = document.getElementById('str').value.trim(); if(str.length==0){ alert('对不起,文本框不能为空或者为空格!');//请将“文本框”改成你需要验证的属性名称! } } //判断日期类型是否为YYYY-MM-DD格式的类型 function IsDate()
正则验证数字的方法: <script type="text/javascript"> function validate(){ var reg = new RegExp("^[0-9]*$"); var obj = document.getElementById("name"); if(!reg.test(obj.value)){ alert("请输入数字!"); } if(!/^[0-9]*$/.test(obj
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Web; using System.Text.RegularExpressions; namespace Common { public class Validate { private static readonly Regex RegPhone = new Regex("(^(\\d{11})$|