email address

xiaoxiao2021-03-06  21

Verify Email Address <% Verify that STR is a legal email address PUBLIC FUNCTION VALIDEMAIL (STR) DIM Strarray, Tempstr, I, Tempchar Validemail = True Strarray = Split (Str, "@") IF Ubound (str, "@") IF ubound (str, "@") IF ubound (str, "<> 1 TEN 'If there is no "@" or contain multiple "@", it is not possible to verify validemail = false exit function end if for veth tempstr in strarray if len (tempstr) <= 0 THEN' if the element in array is empty String, failed to verify validemail = false exit function end if for i = 1 to len (Tempstr) Tempchar = LCase ("AbcdefghijklmnopqrStuvwxyz_-.", Tempchar) <= 0 And not isnumeric (Tempchar) THEN 'If not letters, numbers, "_", "-", ",". ", For illegal characters, fail to pass the validemail = false exit function end if next if leftness (Tempstr 1) = "." Or "if" if "", if "", "the first or final in the string, the validation Validemail = false exit function endiffiffness = false exit function end if next if INSTR (Strarray (1 ), ".") <= 0 Then 'If @ is not ".", Failed to verify validemail = false EX IT Function end if i = le (Strarray (1)) - INSTRREV (Strarray (1), ".") if i <> 2 and i <> 3 dam 'If "." location error, failed to verify validemail = False EXIT FUNCTION END IF IF INSTR (Str, "..")> 0 Then 'If "..", failed to verify validemail = false end = function%>

--------------------------------

Function Validemail (item) {var eTextVar Elenvar ipar aatext = itemlelen = eText.Lengthif (Elen <5) Return True; i = eText.indexof ("@", 0) IF (i == 0 || i == - 1 || i == ELEN-1) Return True; Else {IF (eText.indexof ("@", i 1)! = - 1) Return True;} if (eText.indexof ("..", i 1)! = - 1) Return true; i = eText.indexof (".", 0) IF (i == 0 || i == - 1 || ETEXT.CHARAT (ELEN-1) == '.' ) Return true; if (eText.Charat (0) == '-' || eText.Charat (Elen-1) == '-') Return True; if (eText.Charat (0) == '_' | | EText.Charat (Elen-1) == '_') Return True; for (i = 0; i <= Elen-1; i ) {aa = eText.Charat (i) if (! (((((AA ==) '.') || (AA == '@') || (AA == ') || (AA ==' _ ') || (AA> =' 0 '&& aa <=' 9 ' ) || (AA> = 'a' && aa <= 'z') || (AA> = 'a' && aa <= 'z'))) Return True;} Return False;

IF (Validemail ("Please enter a valid email address!"); form1.mail.focus (); return false;}

--------------------------------

<% Function ISEMAIL (Strng) iSemail = falsedim regex, matchset regex = new regexpregex.pattern = "^ / w ((- / w )) * / @ [A-ZA-Z0-9] (/. | -) [A-ZA-Z0-9] ) * /. [A-ZA-Z0-9] $ "regex.ignorecase = TRUESET MATCH = regex.execute (strng) if match. Count damail = trueend function%>

--------------------------------

function chkEmail (email) on error resume nextdim i, l, pos1, pos2chkEmail = trueif isnull (email) then chkEmail = false: exit function pos1 = instr (email, "@") pos2 = instrRev ( "." email,) if NOT (POS1> 0) or not (POS2> 0) or POS1> POS2 THEN Chkemail = false negative err.Number <> 0 Then Err.clearend Function ----------------- ---------------

Function chK_INPUT (THEFORM) {var email = theform.email.value; var pattern = / ^ ([A-ZA-Z0-9_-]) @ ([A-ZA-Z0-9_-]) (/. [A-ZA-Z0-9 _-]) /; flag = pattern.test (email); if (! flag) {Alert ("email format is incorrect!"); Theform.Email.focus (); Return False }

Return (True);

转载请注明原文地址:https://www.9cbs.com/read-43482.html

New Post(0)