版主不要敷衍我啊 你这里至少应该这样写啊 uname="name"
if InStr(uname,"%")>0 then
response.write "用户名包含非法字符"
else
response.write "用户名未包含非法字符"
end if
我想要的是一个注册页面,用户名旁边有一个检查用户,点击这个按钮,会提示你是否含有非法字符,这个页面还要调用Che_class.asp里的function函数
Class Che_class
public Function IsValidUserName(byVal UserName)
on error resume next
Dim i,c
Dim VUserName
IsValidUserName = True
For i = 1 To Len(UserName)
c = Lcase(Mid(UserName, i, 1))
If InStr("$!<>?#^%@~`&*();:+='"" ", c) > 0 Then
IsValidUserName = False
Exit Function
End IF
Next
For Each VUserName in Register_UserName
If UserName = VUserName Then
IsValidUserName = False
Exit For
End If
Next
End Function
End Class