function format2num(the_num,the_low,the_high) str=the_num i=0 dim regex,match set regex=new RegExp '设置正则对象 regex.Global = True '设置全局匹配 regex.IgnoreCase = false '设置区分大小写,如果false 是区分大小写的 regex.pattern="[0-9]{" & the_low & "," & the_high & "}" '设置匹配内容 set mm=regex.execute(str) '执行 For Each Match in mm ' 循环遍历Matches集合。 if i=0 then thenum=match i=i+1 end if Next if len(thenum)=0 then thenum=0 end if format2num=thenum end function
str=the_num
i=0
dim regex,match
set regex=new RegExp '设置正则对象
regex.Global = True '设置全局匹配
regex.IgnoreCase = false '设置区分大小写,如果false 是区分大小写的
regex.pattern="[0-9]{" & the_low & "," & the_high & "}" '设置匹配内容
set mm=regex.execute(str) '执行
For Each Match in mm ' 循环遍历Matches集合。
if i=0 then
thenum=match
i=i+1
end if
Next
if len(thenum)=0 then
thenum=0
end if
format2num=thenum end function
onkeyup="if(isNaN(this.value))this.value=''"
var reg=/^\d+$/g;
alert(reg.test(value));