Foros del Web » Programando para Internet » Javascript »

validacion campo vacio javascript

Estas en el tema de validacion campo vacio javascript en el foro de Javascript en Foros del Web. Hola estoy validando un campo vacio en js de un formulario , la alerta me sale bien, pero cuando lleno el campo con datos no ...
  #1 (permalink)  
Antiguo 15/06/2011, 12:30
 
Fecha de Ingreso: octubre-2010
Ubicación: Guayaquil
Mensajes: 195
Antigüedad: 13 años, 6 meses
Puntos: 3
validacion campo vacio javascript

Hola estoy validando un campo vacio en js de un formulario , la alerta me sale bien, pero cuando lleno el campo con datos no me pasa a la siguiente pagina, ayuda por favor.

mi codigo:

Código PHP:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml">
<
head>

<
script language="JavaScript">
<!--
function 
verificar()
{
if(
form1.recuperar.value.replace(/ /g'') == '')
{
alert("Debe Ingresar un valor ");
form1.recuperar.focus();
form1.recuperar.select();
return 
false;
}
}
-->
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
<style type="text/css">
.centrar {
    text-align: center;
}
</style>
</head>

<body>
<SPAN STYLE="position:absolute; top:45px; left:374px; font-family: 'Lucida Sans Unicode', 'Lucida Grande', sans-serif; width: 252px; height: 79px;" > 
 

<img src ="lovemoon.jpg" width="250" height="100" align="middle">

</SPAN>

 <SPAN STYLE="position:absolute; top:141px; left:315px; font-family: 'Lucida Sans Unicode', 'Lucida Grande', sans-serif; width: 403px; font-size: 24px; font-weight: bold;" > 
 
      CENTRO DE AYUDA LOVEMOON
 
</SPAN>  
    
<SPAN class="centrar" STYLE="position:absolute; top:170px; left:315px; font-family: 'Lucida Sans Unicode', 'Lucida Grande', sans-serif; width: 403px; font-size: 12px; font-weight: bold;" > 
 
     Escribe tu direecion de correo electronico en el cuadro que aparece abajo y te enviaremos los datos olvidados.
     
</SPAN>


<form name="form1" >
<form method="post" action="recuperar3.php">
<SPAN STYLE="position:absolute; top:185px; left:320px; font-family: 'Lucida Sans Unicode', 'Lucida Grande', sans-serif; width: 335px;" > 
 
 <br>
<input type="text" name="recuperar">
<input type="submit"  value="mandar" onClick="verificar()">
</form>

<img src ="luna sobre mar.jpg" width="570" height="500"
 STYLE="position:absolute; TOP:58px; LEFT:-105px; height: 381px;">

</body>
</html> 
  #2 (permalink)  
Antiguo 15/06/2011, 14:05
 
Fecha de Ingreso: junio-2011
Ubicación: venezuela
Mensajes: 25
Antigüedad: 12 años, 10 meses
Puntos: 0
Respuesta: validacion campo vacio javascript

dentro del if puedes coloca un caso Contrario "else" con esta linia de codigo y te pasa la pagina
document.form1.action='Pagina_que_necesites_llamar .php';
document.form1.submit();

Etiquetas: vacio, campos
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 17:31.