加上这个简单的函数,判断怎么都不成立了?

flybird99 2004-12-14 10:22:45
判断字符串是否合法函数:
function checkstr(str)
if Instr(str,"=")>0 or Instr(str,"%")>0 or Instr(str,chr(32))>0 or Instr(str,"?")>0 or Instr(str,"&")>0 or Instr(str,";")>0 or Instr(str,",")>0 or Instr(str,"'")>0 or Instr(str,",")>0 or Instr(str,chr(34))>0 or Instr(str,chr(9))>0 or Instr(str,"")>0 or Instr(str,"$")>0 then
checkstr=false
end if
end function


调用过程
if checkstr(v_realname)=false then
founderr=true
errmsg=errmsg&"<br><li>您的姓名中含有非法字符!请重新输入!</li>"
end if

可测试时,不管符合不符合都有不成立,显示“重新输入”信息!
大家帮我看看,是调用不对还是函数有错?
...全文
80 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
fogheart 2004-12-14
  • 打赏
  • 举报
回复
function checkstr(str)
checkstr=true
if Instr(str,"=")>0 or Instr(str,"%")>0 or Instr(str,chr(32))>0 or Instr(str,"?")>0 or Instr(str,"&")>0 or Instr(str,";")>0 or Instr(str,",")>0 or Instr(str,"'")>0 or Instr(str,",")>0 or Instr(str,chr(34))>0 or Instr(str,chr(9))>0 or Instr(str,"")>0 or Instr(str,"$")>0 then
checkstr=false
end if
end function

if not checkstr(v_realname) then
founderr=true
errmsg=errmsg&"<br><li>您的姓名中含有非法字符!请重新输入!</li>"
end if
sunboby 2004-12-14
  • 打赏
  • 举报
回复
把楼上两为说的加上
whory 2004-12-14
  • 打赏
  • 举报
回复
先去掉首伟空格
showlin 2004-12-14
  • 打赏
  • 举报
回复
if
...
else
checkstr=true
endif


28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧