ok=true
if(theForm.email.value=="")
{
alert("U dient een geldig e-mail adres in het \"e-mail\" veld in te voeren.")
theForm.email.focus()
ok=false
}
else
{
mail=theForm.email.value
at_pos=mail.indexOf("@")
dot_pos=mail.indexOf(".")
if(at_pos<1 || dot_pos<1)
{
alert("Gelieve de positie van de '@' en van de '.' te controleren. ")
theForm.email.focus()
ok=false
}
else
{
mail=theForm.email.value
condition="yes"
var at_count=0
var dot_count=0
var temp=0
for(var i=0;i<mail.length;i++)
{
if((mail.charCodeAt(i)>0 && mail.charCodeAt(i)<48)||(mail.charCodeAt(i)>57 && mail.charCodeAt(i)<65)||(mail.charCodeAt(i)>91 && mail.charCodeAt(i)<97)||mail.charCodeAt(i)>122)
{
if(mail.charAt(i)=="@"||mail.charAt(i)==".")
{
if(mail.charAt(i)=="@"){at_count++}else{dot_count++} // counts the no. of times @ and . appears in email
if(dot_count>=1)
{
dot_pos=i
if((dot_pos>at_pos) && temp==0)
{
pos=dot_pos-at_pos
temp++
}
}
}
else
{
condition="no"
i=mail.length
}
}
}
if(condition=="no")
{
alert("Uw e-mail adres bevat een spatie of een speciaal karakter.")
theForm.email.focus()
ok=false
}
else
{
if(at_count>1)
{
alert("Uw e-mail adres bevat een '@' te veel.")
theForm.email.focus()
ok=false
}
else
{
if(pos<2)
{
alert("Er staat geen domein tussen '@' en '.'")
theForm.email.focus()
ok=false
i=mail.length
}
else
{
count=dot_pos+1
domain=""
for(count;count<mail.length;count++)
{
domain=domain+mail.charAt(count)
}
dom=new Array("au","com","net","org","edu","in","mil","gov","arpa","biz","aero","name","coop","info","pro","museum")
error="yes"
for(var k=0;k<dom.length;k++)
{
if(domain==dom[k])
{
k=dom.length
error="no"
}
}
if((error=="yes" && (domain.length>2)) || (domain.length<2))
{
alert("Het domein moet eindigen met een gekende domein extentie of een landnaam extentie van 2 letters zoals .be, .com, .info, enz.")
theForm.email.focus()
ok=false
}
// begin vergelijking email velden. //
if (theForm.email.value != theForm.emailb.value)
{
alert('Email adressen zijn niet hetzelfde');
theForm.emailb.focus()
return false;
}
// einde vergelijking email velden. //
}
}
}
}
}
return ok