法院 曝光老赖:asp中怎样判断文本框中是否输入了空格

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/05 06:10:05
asp中怎样判断文本框中是否输入了空格
能否写得具体点阿,最好是不能含有空格,或者说输入的内容必须要有字符

InStr("ddddd"," ")
如果反回值为0是没有空格,如果大于0刚为有空格

可以用VBScript中的Trim()函数(去掉空格用的)
if 字符串=Trim(字符串) then
....
end if

<%
if Instr(字符串,"=")>0 or Instr(字符串,"%")>0 or Instr(字符串,chr(32))>0 or Instr(字符串,"?")>0 or Instr(字符串,"&")>0 or Instr(字符串,";")>0 or Instr(字符串,",")>0 or Instr(字符串,"'")>0 or Instr(字符串,",")>0 or Instr(字符串,chr(34))>0 or Instr(字符串,chr(9))>0 or Instr(字符串,"?")>0 or Instr(字符串,"$")>0 then
errmsg=errmsg+"<br><li>输入中含有非法字符</li>"
founderr=true
end if
%>
(以上是对非法字符的限制,一般用在用户注册填写信息的时候比较合适)