Hola a todos.
Tengo la siguiente función la cual valida un mail con el siguiente formato:
[email protected]
<script language="JavaScript">
<!--
function validar(pass){
var pos1, pos2, bOk = true;
var sDir = document.frm.txtEMail.value;
if (sDir == ""){
alert("DEBE INGRESAR EL MAIL");
document.frm.txtEMail.focus();
return false;
}
pos1 = sDir.indexOf('@', 0);
pos2 = sDir.indexOf('.', 0);
bOk = bOk && (pos1 > 0);
bOk = bOk && (pos2 != -1);
bOk = bOk && (pos1 < pos2 - 1);
bOk = bOk && (pos2 < sDir.length - 1);
if (!bOk){
alert("DIRECCION DE CORREO NO VALIDA");
document.frm.txtEMail.focus();
return false;
}
return true
}
-->
</script>
Como le puedo hacer para validar un mail que tenga el siguiente formato:
[email protected]
Gracias Por su ayuda.