asp中表单检验的问题
人气:
37
【字体:大 中 小】
发布时间:2007-04-15 18:08:17
>>>>>>>>提问我想检测电话中可以含有数字 横杠和点 请问怎么检测?
我是新手 拜托大家给我个例子看看
休 闲 居 编 辑
求你们了 用正则表达式也行啊
>>>>>>>>休闲养生网回答: str="0123456789.-"
tele="86. 010 - 12ab3c4-56.7"
tele=replace(tele," ","") //去掉空格
方法一:
for i=1 to len(tele)
if instr(str,mid(tele,i,1))=0 then
response.write "对不起,电话号码中不能包含"&mid(tele,i,1)
exit for
end if
next
方法二:
newTele=""
for i=1 to len(tele)
if instr(str,mid(tele,i,1))<>0 then
newTele=newTele & mid(tele,i,1)
end if
next
显示结果:86.010-1234-56.7
≡ 查看、发表评论 ≡