Share a piece of ASP form validation code

Source: Internet
Author: User

The

code is as follows

<% ' ================================================= ' Lonz general function ' =============================================          = = ' string length with kanji function strlen (str) Dim P_len p_len=0 strlen=0 If trim (str) <> "Then P_len=len (Trim (str)) for Xx=1 to P_len if ASC (Mid (str,xx,1)) <0 then Strlen=int (s Trlen) + 2 else Strlen=int (strlen) + 1 End If Next End If End fun Ction ' maximum number of characters; returns true, otherwise false;maxnum: Maximum number of characters, Strmaxnum: Character function Bymaxnum (maxnum,strmaxnum) If Len (strmaxnum) > Maxnum then bymaxnum=true else Bymaxnum=false End IfEnd Function ' minimum number of characters; returns true, otherwise false;maxnum: Maximum number of characters, Strmaxnum: Character Fu Nction Byminnum (Minnum,strminnum) If Len (strminnum) <minnum then byminnum=true else Byminnum=false End IfEnd Functio n ' check input not all or not for kanji, return true, otherwise return falsefunction Isnotcs (strcs) Dim Getcs For Cp=1 to Len (Strcs) Getcs=mid (strcs,cp,1) if ASC (get CS) >=0 then isnotcs=true exit FunctioN End If Isnotcs=false nextend function ' is a non-email address, returns true for a non-email address, or false if the condition: "@" function isnotemail (email) Dim names, Name, I, cisnotemail = Falsenames = Split (email, "@") if UBound (names) <> 1 Then Isnotdemail = True EX  It functionend iffor each name in Names if Len (name) <= 0 and Isnotemail = True Exit Function End If for i = 1 to Len (name) c = Lcase (Mid (name, I, 1)) If INSTR ("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 and not Isnume  Ric (c) Then Isnotemail = True Exit Function End If Next if left (name, 1) = "." or Right (name, 1) = "." Then Isnotemail = True Exit Function End Ifnextif InStr (names (1), ".") <= 0 Then Isnotemail = True Exi T functionend ifi = Len (names (1))-InStrRev (names (1), ".") If I <> 2 and I <> 3 then Isnotemail = True Exit FunctionEnd ifif InStr (email, "...") > 0 Then Isnotem ail = TrueEnd IfEnd function ' contains illegal characters; only English letters, numbers, "-", "_", "." are allowed. function Havespchar (Strspchar)  Havespchar = False Dim sp,csp For sp = 1 to Len (strspchar) CSP = Lcase (Mid (Strspchar, SP, 1)) If INSTR ("ABCD efghijklmnopqrstuvwxyz_-. ", CSP) <= 0 and not IsNumeric (CSP) Then Havespchar = True Exit Function End I F NextEnd function%>
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.