(在线等)asp出现某字母就报错?

来源:百度知道 编辑:UC知道 时间:2024/06/05 13:51:38
if request.form("title")="Hi" then
response.write "<script language=javascript>alert('非法输入!');history.back(-1);</script>"
response.end
end if

这个只能出现”Hi”时才提示.

高手们.怎么样才能当它出现任何字母时都报错呢?

或都干脆不能输入字母.

先谢谢了!!!
我的意思是不能输入字母.只能输入汉字

谢谢!!

只要用一些字符串函数就可以了。
如 if instr(request.form("title"),"a")>0 then
..........
end if
instr函数就是查找字符串中是否有 a 这个字符若有则返回其在字符串中的位置。若无则返回零。当然也可以这样查找在title中是否有某个字符串,只要把"a"改为相应的字符串就可以了。

是只能输入数字还是怎么回事啊?
if not isnumeric(request.form("title")) then
response.write "<script language=javascript>alert('不能出现任何字母!');history.back(-1);</script>"
response.end
end if

下面是不能输入任何东西的
if request.form("title")<>"" then
response.write "<script language=javascript>alert('不能出现任何字母!');history.back(-1);</script>"
response.end
end if

下面是只能输入汉字的:
<%
'正则表表达式验证函数 patrn-正则表达式 strng-需要验证的字符串
<%
Function RegExpTest(patrn, strng)
Dim regEx' 建立变量。
Set regEx = New RegExp ' 建立正则表达式。
regEx.Pattern = patrn ' 设置模式。
regEx.IgnoreCase = Fals