ξσ Dicky's Blog σξ

朋友多了,寂寞卻沒少,朋友沒有了你,得到了天下最高的技術又能如何?人類的全部才能無非是時間和耐心的混合物.---巴尔扎克

Traditional Chinese

导航

在ASP控制数字及字母输入

 1如何在Asp中象在JavaScrip里一样控制输入的值只能是英文或数字,现在我整理如下,下面我以接收变量String的值讲解如下:
 2
 3方法一:
 4Str = Request("String")
 5Temp = Server.Urlencode(Str)
 6If Str = Temp Then
 7    Response.Write "你输入的不是英文或数字"
 8End If
 9
10文法二:
11Str = Request("String")
12For I = 1 To Len(Str)
13    A = Mid(String,I,1)
14    If ((Asc(A) < "0" And Asc(A)> "9" ) Or (Asc(A) < Asc("A"And Asc(A)>Asc("Z"))) Then 
15        Response.Write "你输入的不是英文或数字"
16    End If
17Next I

posted on 2005-06-11 11:49  ξσ Dicky σξ  阅读(655)  评论(0编辑  收藏  举报