Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

check if the e-mail is valid

Status
Not open for further replies.

emi

Programmer
Nov 1, 2001
2
BG
I have this function in javascript to check if the e-mail in the form is valid and I can't write it on VBScript, because I don't know what is the analog of SUBSTRING and LENGHT.
May be somebody can help me how to check it?

function mailAddressIsValid(mailAddress)
{
var atPresent=false;
var dotPresent=false;
for(var i=0; i < mailAddress.length;i++)
{
var c=mailAddress.substring(i,i+1);
if(c == &quot;@&quot;)
atPresent=true;
if(c == &quot;.&quot;)
dotPresent=true;
}
if(atPresent == true && dotPresent == true)
return true;
else
return false;
}
 
IIRC, the VBScript equivalents are the MID() and LEN() functions.

MID(mailaddress,i,i+1)
LEN(mailaddress) Jon Hawkins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top