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
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