当前位置: 代码迷 >> vbScript >> for.next语句,该怎么处理
  详细解决方案

for.next语句,该怎么处理

热度:6496   发布时间:2013-02-26 00:00:00.0
for...next语句
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

%>
  相关解决方案