一个郁闷的ASP有关问题,解急给分~


        一个郁闷的ASP问题,解急给分~~~!<br />

郁闷的问题,,刚刚拿了个注册程序,就一个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  


.net 程序开发 asp

总理D军道杀拳 9 years, 11 months ago


楼主可先用response.write ID
response.write "不能为空. "
测试.
一步步来,总是错不了的

不撸不舒服斯基 answered 9 years, 11 months ago


试试if ID = " " or ID = NULL then

俺是新手,不知道request里有没有这种情况,说的不对别笑俺。

懒趴趴D修也 answered 9 years, 11 months ago

怎么才能让提问上版块,望您告知下,谢过!

工口小蘑菇 answered 9 years, 11 months ago

Your Answer