Ver Mensaje Individual
  #3 (permalink)  
Antiguo 08/12/2006, 04:02
f_murciano
 
Fecha de Ingreso: febrero-2004
Mensajes: 157
Antigüedad: 20 años, 3 meses
Puntos: 0
Re: Validar un decimal sin dos comas

Gracias JavierB

He puesto un par de cosillas a la función como me comentas, aquí la pongo:
Código PHP:
<html>
<
head>
<
script>
    function 
numeros(e,txt) {
        
tecla = (document.all) ? e.keyCode e.which;
    if (
tecla==8) return true//Tecla de retroceso (para poder borrar)
        
if ((tecla<48 || tecla>57) && tecla!=46 && tecla!=44 ) return false
        
if (tecla == 46 && (txt.indexOf('.')!=-|| txt.indexOf(',')!=-1)) return false;
        if (
tecla == 44 && (txt.indexOf(',')!=-|| txt.indexOf('.')!=-1)) return false;
    }
</script>
</head>
<body>
<input type="text" onKeyPress="return numeros(event,this.value)">
</body>
</html> 
Pero no encuentro una tabla de caracteres que tenga el suprimir y los cursores para añadírselos a la función.

¿Tienes alguna información y completo un poco más la función?

Muchas gracias.