您的当前位置:教程首页 --> ASP教程 --> ASP应用 --> 在ASP控制数字及字母输入

在ASP控制数字及字母输入

发布时间:2010/03/15  来源:网络  点击次数:64次
最近常有朋友问我如何在ASP中象在JavaScrip里一样控制输入的值只能是英文或数字,现在我整理如下,下面我以接收变量string的值讲解如下:
方法一:
str=Request("string")
temp=Server.URLEncode(str)
if str=temp then
    response.write "你输入的不是英文或数字"
end if
文法二:
str=Request("string")
for i=1 to len(str)
     a=mid(string,i,1)
     if ((asc(a)<"0" and asc(a)>"9" ) or (asc(a)<asc("a") and asc(a)>asc("z"))) then
  response.write "你输入的不是英文或数字"
 end if
next i

站长QQ:28212441

太仓交友 张家界会议网 齐齐商务  直流电机维修 

Copyright © 2007 www.herecn.com! company. All rights reserved.

苏ICP备09011162号