My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Validar email</title>
<script type="text/javascript">
function validarEmail(valor) {

if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3,4})+$/.test(valor))
alert("La dirección de email " + valor + " es correcta.");
else
alert("La dirección de email es incorrecta.");

}
</script>
</head>
<body>
<h1>Validar email</h1>

<form>
<label for="email">Email:</label><input type="text" id="email" size="100">
<button onClick="validarEmail(document.getElementById('email').value);">Validar e-mail</button>
</form>


<br><br>
<hr>
Art&iacute;culo disponible en: <a href="http://lineadecodigo.com/2009/01/09/validar-el-email-con-javascript/">http://lineadecodigo.com/2009/01/09/validar-el-email-con-javascript/</a><br/>
<a href="http://lineadecodigo.com" title="Linea de Codigo">lineadecodigo.com</a>


</body>
</html>

Change log

r138 by vcuervo on Jun 20, 2009   Diff
No se estaban contemplando emails que
acabasen con 4 letras. Como .mobi o .info.
Go to: 
Project members, sign in to write a code review

Older revisions

r71 by vcuervo on Jan 9, 2009   Diff
Validar email.
r70 by vcuervo on Jan 9, 2009   Diff
Validar email.
All revisions of this file

File info

Size: 967 bytes, 32 lines
Powered by Google Project Hosting