I'm opting for:
or whatever...
Recently I circled around this email validation thing for some little time ;) trying to figure every possible combination, permutation, country, .com, .us.gov, .x.x.et.al. that could possibly work in all scenarios! There is no perfect solution, so I choose the minimalist thing and put the good input responsibility on the user.
I used regexp object (since I was reading up on regular expresssions):
myregexp = /[^\w@.-]/;
And then test for just those characters:
function checkEmail(){
.
.
.
document.getElementById('email').onblur = function(){
var input_value = document.getElementById("email").value;
if (myregexp.test(input_value)) {
alert("Please enter a valid email address to check!");
return;
}
.
.
.
And then, to 'call' your function do:
window.onload = function(){
checkEmail();
}
Notice the onblur event handler, instead of an element attribute radio or checkbox type; this way user only need alter the focus. Hope this helps.