Ver Mensaje Individual
  #7 (permalink)  
Antiguo 08/03/2012, 13:26
ginger774
 
Fecha de Ingreso: marzo-2012
Mensajes: 1
Antigüedad: 12 años, 1 mes
Puntos: 0
Respuesta: Validación de campos numéricos POSITIVOS y con 3 decimales...

Mi funcion, para permitir numeros y 3 decimales

function verificarNumero(evt){
// Espacio = 8, Enter = 13, '0′ = 48, '9′ = 57, '.' = 46
var key = nav4 ? evt.which : evt.keyCode;
var mensaje = $('cuotaArticulo').value;
for(var i = 0; i<mensaje.length; i++){
if(mensaje.charAt(i) =='.'){
if((key == 8)){
return key;
}
else
if((key == 46) || mensaje.charAt(i+3)){
return false;
}
}
}

return (key <= 13 || (key >= 48 && key <= 57) || key == 46);
}