﻿sub checkform()
    dim username
    dim password
    dim num1
    
    username=document.getElementById("TextBox1").value
    password=document.getElementById("TextBox2").value
    num1=document.getElementById("Textbox3").value
'=====================================================================================  
    if username="" then
       msgbox "请输入会员帐号!",vbinformation,"agenow提示"    
       document.getElementById("TextBox1").focus
       exit sub
    end if
'=====================================================================================    
    if len(password)<6 then
       msgbox "请输入正确的密码。",vbinformation,"agenow提示" '"密码由6-20个英文字母(区分大小写)或数字组成。"
       document.getElementById("TextBox2").focus
       exit sub
    end if
    
    for i=1 to len(password)
        st1=mid(password,i,1)
        isok=Isabc(st1)
        if isok=0 then  isok=Is123(st1)
        if isok=0 then  isok=IsABC1(st1)
        
        if isok<>1 then
           msgbox "请输入正确的密码。",vbinformation,"agenow提示" '"密码由6-20个英文字母(区分大小写)或数字组成。"
           document.getElementById("TextBox2").focus
           exit sub
        end if              
    next
    
'===================================================================================== 
   if len(num1)<>5 then
      msgbox "请输入正确的验证码。",vbinformation,"agenow提示"
      document.getElementById("TextBox3").focus
      exit sub
   end if    
    
   for i=1 to len(num1)
       st1=mid(num1,i,1)
       isok=Is123(st1)
       if isok<>1 then
          msgbox "请输入正确的验证码",vbinformation,"agenow提示"
          document.getElementById("TextBox3").focus
          exit sub
       end if
   next     
'=====================================================================================   
    document.getElementById("Button1").click() 

end sub

Function Isabc(st)
    dim j
    for j=97 to 122
        if st=chr(j) then
           Isabc=1
           exit function
        end if        
    next
    Isabc=0
End Function

Function IsABC1(st)
    dim j
    for j=65 to 90
        if st=chr(j) then
           IsABC1=1
           exit function
        end if        
    next
    IsABC1=0
End Function

Function Is123(st)
        dim j
        for j=0 to 9
            if cstr(st)=cstr(j) then
               Is123=1
               exit function
            end if 
        next
        Is123=0
End Function

sub getcode()
    document.getElementById("img1").src="ValidateNumber.aspx?t=" & now()
end sub

sub gotoreg()
    window.location.href="Register.aspx"
end sub


