Ver Mensaje Individual
  #7 (permalink)  
Antiguo 11/11/2009, 09:37
Avatar de dcreate
dcreate
 
Fecha de Ingreso: octubre-2009
Ubicación: Veracruz
Mensajes: 536
Antigüedad: 15 años, 3 meses
Puntos: 22
Respuesta: Validar si un numero se encuentra dentro de un rango determinado

hola, estaba viendo tu tema, y vi q querias validar e solo entrada de numeros en una caja de texto, aki te dejo esto, haber si te sirve:

Código php:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5. <title>Documento sin t&iacute;tulo</title>
  6. <script>
  7. var nav4 = window.Event ? true : false;
  8. function acceptNumNumero(evt)
  9. {
  10. // NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57
  11. var key = nav4 ? evt.which : evt.keyCode;
  12. return ((key >= 48) && (key <= 57) || (key == 8));
  13. }
  14.  
  15. </script>
  16.  
  17. </head>
  18.  
  19. <body>
  20. <form name="form1" action="" method="post">
  21. <input type="text" name="medida" onKeyPress="return acceptNumNumero(event)">
  22. </form>
  23. </body>
  24. </html>