Here is a simple function for the control of the validity of the e-email inserted in form.
Script that checks an entered Email address
function controllaemail(email)
{
var snail = false
var point = false
var puntochiocciola = false
for (var i = 0; i <= email.length; i ++) {
if (email.charAt(i) == “@”){
at sign = true
puntochiocciola = email.indexOf(email.charAt(i)) + 1
break
}
}
for (var i = 0; i <= email.length; i ++)
{
if (puntochiocciola && email.charAt(i) == “.” && i > (email.length – 4) && i < (email.length – 2))
{
var point = true
break }
else {
if (! hazelnut && email.charAt (i) == “.” && i> hazelnut && i <(email.length - 2))
{
var point = true
break
}
}
}
if (! at sign ||! period) {
var error = (! at &&! period)? "Both the dot and the snail are missing." : (period == true &&! at sign)? "The snail is missing." : (at sign == true &&! period)? "The point is missing." : ""
window.alert ("Beware of the email address you typed" + error)
}
}
Check email
Enter an e-mail address:
</form>