Hi, i am new to Javascript ... i am making a form in html and validating it via JS...recently i found a code for email validation from web surfing...i understand the basic purposes of the functions used in this code but i am not able to understand the logic well...please if any one can make me understand the logic of this code easily..its become hectic for me alot...please go step wise in your answer while explaining...code is;
if (document.formname.fieldname.value.length >0) {
i=document.formname.fieldname.value.indexOf("@")
j=document.formname.fieldname.value.indexOf(".",i)
k=document.formname.fieldname.value.indexOf(",")
kk=document.formname.fieldname.value.indexOf(" ")
jj=document.formname.fieldname.value.lastIndexOf(".")+1
len=document.formname.fieldname.value.length
if ((i>0) && (j>(1+1)) && (k==-1) && (kk==-1) && (len-jj >=2) && (len-jj<=3)) {
}
else {
alert("Please enter an exact email address.\n" +
document.formname.fieldname.value + " is invalid.");
return false;
}
}
I will be very very thankful to you people...anxiously waiting for reply...Regards!!!