- VBScript code
<%function Isusername(username,lenmin,lenmax) Char="abcdefghijklmnopqrstuvwxyz.-_0123456789" username=Lcase(username) Isusername=true for i = 1 to Len(username) if Instr(Char,mid(username,i,1))<1 then Isusername=false exit for next ''这里报错 错误的NEXT if Isusername=true and ( Len(username)<Cint(lenmin) or Len(username)>Cint(lenmax) ) then Isusername=false if Isusername=true and ( Left(username,1) < "a" or Left(username,1) > "z" ) then Isusername=falseend function%>
验证输入用户名的语句。帮忙看下,谢了。
------解决方案--------------------------------------------------------
没见这你这么验证的,不过还是给你改一下,就是丢了一个end if
<%
function Isusername(username,lenmin,lenmax)
Char="abcdefghijklmnopqrstuvwxyz.-_0123456789"
username=Lcase(username)
Isusername=true
for i = 1 to Len(username)
if Instr(Char,mid(username,i,1))<1 then
Isusername=false
exit for
end if
next ''这里报错 错误的NEXT
if Isusername=true and ( Len(username)<Cint(lenmin) or Len(username)>Cint(lenmax) ) then Isusername=false
if Isusername=true and ( Left(username,1) < "a" or Left(username,1) > "z" ) then Isusername=false
end function
%>