Ver Mensaje Individual
  #2 (permalink)  
Antiguo 15/08/2012, 11:32
Avatar de Dradi7
Dradi7
 
Fecha de Ingreso: junio-2008
Ubicación: Peru - Lima
Mensajes: 1.518
Antigüedad: 15 años, 11 meses
Puntos: 220
Respuesta: Formulario donde limite el número de caracteres y solo escriba números con

pero no te bastaria sencillamente con el maxlength del input o en todo caso puedes acceder a su id del input y validarlo dentro del script asi

Código Javascript:
Ver original
  1. var nav4 = window.Event ? true : false;
  2. function acceptNum(evt)
  3. {
  4. // NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57
  5. var input = document.getElementById("input_id");
  6. if(input.value.length>5){//la cantidad que quieras
  7. return false;
  8. }
  9. var key = nav4 ? evt.which : evt.keyCode;
  10.  return (key <= 13 || (key >= 48 && key <= 57));
  11. }
__________________
La clave de todo triunfador es eliminar todas sus excusas y sus limitaciones