Ver Mensaje Individual
  #2 (permalink)  
Antiguo 17/01/2009, 23:24
Avatar de marcopoloaz06
marcopoloaz06
 
Fecha de Ingreso: julio-2007
Ubicación: México
Mensajes: 457
Antigüedad: 17 años, 7 meses
Puntos: 11
Respuesta: ayuda validar 2 campos no letras, no patir con 0, etc

Holas, aver si esto te sirve:
js:
Código javascript:
Ver original
  1. function valida(f, f2){
  2.     var exp = /^[1-9]\d*$/;
  3.     var val = f.value;
  4.     if (val.indexOf("0") == 0)
  5.         f.value = "";
  6.     if (!exp.test(val))
  7.         f.value = f.value.substring(0, val.length - 1);
  8.     if (f2 && Number(f.value) > Number(document.getElementById(f2).value) )
  9.         f.value = "";
  10. };
html:
Código HTML:
 <input type="text" onkeyup="valida(this);" id="f1" />
    <input type="text" onblur="valida(this,'f1');" id="f2" /> 
saludoss
:]
__________________
Aerolíneas Alicia :D