Tema: Validación
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/06/2012, 22:23
yonerflash
 
Fecha de Ingreso: noviembre-2004
Ubicación: Medellín
Mensajes: 121
Antigüedad: 19 años, 5 meses
Puntos: 1
De acuerdo Validación

Hola, cuando quiero validar un textbox, los números se desaparecen.
Y otra cosa... como puedo pasarle el foco al siguiente textbox, he visto códigos pero que no hacen las dos cosas al tiempo

<script type="text/javascript">
function validar(e) {
tecla = (document.all)?e.keyCode:e.which;
if (tecla==8 || tecla==0){
return true;
}
patron = /([0-9\.])/;
te = String.fromCharCode(tecla);
}
</script>

<form action="" method="post" name="form1" id="form1">
<table width="291" border="1">
<tr>
<td width="108">Cedula</td>
<td width="10">&nbsp;</td>
<td width="151"><label>
<input type="text" name="texCedula" id="texCedula" maxlenght="12" onKeyPress="return validar(event)"/>
</label></td>
</tr>
<tr>
<td>Nombres</td>
<td>&nbsp;</td>
<td><label>
<input type="text" name="texNombres" id="texNombres" />
</label></td>
</tr>
<tr>
<td>Apellidos</td>
<td>&nbsp;</td>
<td><label>
<input type="text" name="texApellidos" id="texApellidos" />
</label></td>
</tr>
<tr>
<td><label>
<input type="submit" name="butGuardar" id="butGuardar" value="Guardar" />
</label></td>
<td>&nbsp;</td>
<td><input type="button" name="butLimpiar" id="butLimpiar" value="Limpiar" /></td>
</tr>
</table>

</form>