Ver Mensaje Individual
  #2 (permalink)  
Antiguo 14/04/2010, 14:17
Avatar de FaridJC
FaridJC
 
Fecha de Ingreso: abril-2010
Mensajes: 2
Antigüedad: 14 años
Puntos: 0
Respuesta: restringir valores en un input tipo texto

Creo que sería algo como

Código Javascript:
Ver original
  1. function numero(){
  2. if((document.getElementById('numero').value<0)||(document.getElementById('numero').value>60)){
  3. alert('numero no valido');
  4. } else {
  5. document.formulario.submit();
  6. }
  7. }

Código HTML:
Ver original
  1. <form id="formulario">
  2.     Numero:<input type="text" maxlength="2">
  3.     <input type="button" onclick="numero()" value="enviar">
  4. </form>