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

3
方法一:4
Str = Request("String")5
Temp = Server.Urlencode(Str)6
If Str = Temp Then7
Response.Write "你输入的不是英文或数字"8
End If9

10
文法二:11
Str = Request("String")12
For 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 If17
Next I