首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > vbScript >

for.next语句,该怎么处理

2012-03-02 
for...next语句VBScript code%function Isusername(username,lenmin,lenmax)Charabcdefghijklmnopqrstu

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

%>

热点排行