一个郁闷的ASP问题,解急给分~~~!
郁闷的问题,,刚刚拿了个注册程序,就一个reg.asp文件,数据库的连接肯定是好的,然后里面出现了一些小的HTML标签问题吧,应该不影响的.关键是我用response.wirte(ID)可以显示出request( "ID ")包括空 " "(什么也不显示),但是问题就是居然我可以用出elseif的( " "用户名不能含有特殊字符 " ")却用不出( " "用户名不能为空! " ")的javascript,为什么呀,想破了都没知道为什么..
代码如下:
<%dim ID,PASSWORD
ID=trim(request.form( "ID "))
PASSWORD=trim(request.form( "PASSWORD "))
if ID = " " then
response.write " <script> alert( " "用户名不能为空! " ");
location.href= " "javascript:history.go(-1) " "; </script> "
elseif instr(ID, " ' ")> 0 or instr(ID, "; ")> 0 or instr(ID, ", ")> 0 or instr(ID, "` ")> 0 or instr(ID, "/ ")> 0 or instr(ID, "! ")> 0 or instr(ID, "char(34) ")> 0 or instr(ID, "? ")> 0 or instr(ID, "* ")> 0 or instr(ID, "& ")> 0 or instr(ID, "@ ")> 0 then
response.write " <script> alert( " "用户名不能含有特殊字符! " ");
location.href= " "javascript:history.go(-1) " "; </script> "
response.end
end if
------解决方案--------------------试试if ID = " " or ID = NULL then
俺是新手,不知道request里有没有这种情况,说的不对别笑俺。
------解决方案--------------------楼主可先用response.write ID
response.write "不能为空. "
测试.
一步步来,总是错不了的