Está en la página 1de 4

<html>

<head>
<title>
Este es un formulario de ingreso de datos
</title>
<script language="javascript">
<!--
function nombre(num)
{
var expresion=new RegExp(/\D{3,6}/);
do{

if(expresion.test(num))
alert("Su nombre esta correcto");
else
alert ("Este campo acepta solo letras,
intente nuevamente");
exit();
}while (num !=null);
}
function apellido(ap)
{
var expresion=new RegExp(/\D{3,6}/);
do{

if(expresion.test(ap))
alert("Su apellido esta correcto");
else
alert ("Este campo acepta solo letras,
intente nuevamente");
exit();
}while (ap !=null);
}
function email(em)
{
var expresion=new RegExp(/[\w-\.]{3,}@([\w-]
{2,}\.)*([\w-]{2,}\.)[\w-]{2,4}/);
do{

if(expresion.test(em))
alert("Su email esta correcta");
else
alert ("Su email esta incorrecto, intente
nuevamente");
exit();
}while (em !=null);
}
function contrase�a(xx)
{
var expresion=new RegExp(/(?!^[0-9]*$)(?!^[a-zA-
Z]*$)^([a-zA-Z0-9]{8,10})$/);
do{

if(expresion.test(xx))
alert("Su contrase�a esta correcta");
else
alert ("Su contrase�a esta incorrecto,
intente nuevamente");
exit();
}while (xx !=null);
}
function fecha(fc)
{
var expresion=new
RegExp(/^\d{1,2}\/\d{1,2}\/\d{2,4}$/);
do{

if(expresion.test(fc))
alert("Su fecha de nacimiento esta
correcta");
else
alert ("Su fecha de nacimiento esta
incorrecta, intente nuevamente");
exit();
}while (fc !=null);
}
function telefono(fono)
{
var expresion=new RegExp(/^[0-9]{2,3}-? ?[0-9]
{6,7}$/);
do{

if(expresion.test(fono))
alert("Numero de telefono correcto");
else
alert ("Numero de telefono incorrecto,
intente nuevamente");
exit();
}while (fono !=null);
}
//-->
</script>
</head>
<body BGCOLOR="BLACK">
<h2>
<center>
<font face="Castellar" color="RED">Formulario de ingreso de
datos<hr WIDTH=38%></font>
</center>
</h2><br><br>
<center>
<h3>
<font color="YELLOW">
<form>
Por favor, ingrese su Nombre:
<input name="num">
<input type="button"
value= "Enviar"
onClick="nombre(this.form.num.value)">
<font color="BLUE" size="2">(Min. 3 letras)</font>
</form>
</font>
</h3>
</center><br><br>
<center>
<h3>
<font color="YELLOW">
<form>
Por favor, ingrese su Apellido:
<input name="ap">
<input type="button"
value= "Enviar"
onClick="apellido(this.form.ap.value)">
<font color="BLUE" size="2">(Min. 3 letras)</font>
</form>
</font>
</h3>
</center><br><br>
<center>
<h3>
<font color="YELLOW">
<form>
Por favor, ingrese su email:
<input name="em">
<input type="button"
value= "Enviar"
onClick="email(this.form.em.value)">
</form>
</font>
</h3>
</center><br><br>
<center>
<h3>
<font color="YELLOW">
<form>
Por favor, ingrese su contrase�a:
<input name="xx">
<input type="button"
value= "Enviar"
onClick="contrase�a(this.form.xx.value)">
<font color="BLUE" size="2">(Min. 8 Max. 10 con un
numero)</font>
</form>
</font>
</h3>
</center><br><br>
<center>
<h3>
<font color="YELLOW">
<form>
Por favor, ingrese su fechade nacimiento:
<input name="fc">
<input type="button"
value= "Enviar"
onClick="fecha(this.form.fc.value)">
<font color="BLUE" size="2">(Por ejemplo
dd/mm/aa)</font>
</form>
</font>
</h3>
</center><br><br>
<center>
<h3>
<font color="YELLOW">
<form>
Por favor, ingrese su fechade nacimiento:
<input name="fono">
<input type="button"
value= "Enviar"
onClick="telefono(this.form.fono.value)">
</form>
</font>
</h3>
</center>
</body>
</html>

También podría gustarte