La otra funcion es esta:
function ValidarDirCorreoElectronico(emails) {
var caracteres = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqr stuvwxyz0123456789_-.";
var i;
var valido = true;
var pos_arroba = emails.indexOf("@");
var pos_ultimo_punto = emails.lastIndexOf(".");
var emails_minus = emails.toLowerCase();
var trozo;
if (pos_arroba == -1) {
return false;
}
if (emails_minus.indexOf("
[email protected]& quot;) != -1){
return false;
}
if (pos_ultimo_punto == -1) {
return false;
}
trozo = emails.substring(0, pos_arroba);
for(i=0;i<trozo.length;i++) {
if (caracteres.indexOf(trozo.charAt(i)) == -1) {
valido = false;
break;
}
}
if (!valido) {
return false;
}
valido = true;
trozo = emails.substring(1+pos_arroba, pos_ultimo_punto);
for(i=0;i<trozo.length;i++) {
if (caracteres.indexOf(trozo.charAt(i)) == -1) {
valido = false;
break;
}
}
if (!valido) {
return false;
}
valido = true;
trozo = emails.substring(1+pos_ultimo_punto, emails.length);
if ((trozo.length >= 2)&&(trozo.length <= 3)) {
for(i=0;i<trozo.length;i++) {
if (caracteres.indexOf(trozo.charAt(i)) == -1) {
valido = false;
break;
}
}
if (!valido) {
return false;
}
} else {
return false;
}
return true;
}
function Enviar() {
var f = document.forms["armatuviaje"];
if (ValidarDirCorreoElectronico(f.emails.value)) {
return true;
}
else {
alert("La dirección de correo electrónico no es correcta");
f.emails.focus();
f.emails.select();
return false;
}
}
Voy a probar lo que me dices y te cuento.