I want that when typing one, I change it for a. in an input that only accepts numbers. For the moment I have managed to get the input to only accept numbers, but I need the part to change the, for a point But I'm a little Lost with the subject.
Could someone tell me where to shoot to do it? I have seen code that you do once you send the form, but I try to do it on the fly and I have not been able to adapt code to do it as I need.
this is what I have at the moment:
function Comprobarnum(e) {
var numeros = "0123456789,-"; // Variables que definen los caracteres permitidos
var teclas_especiales = [37, 8, 39, 46, 190, 188, 9, 173]; //46 = Supr, 37 = flecha izquierda, 39 = flecha derecha
var evento = e || window.event; // Obtener la tecla pulsada
var tecla = evento.charCode || evento.keyCode;
var caracter = String.fromCharCode(tecla);
var tecla_especial = false; // Comprobar si la tecla pulsada es alguna de las teclas especiales
for(var i in teclas_especiales) {
if(tecla == teclas_especiales[i]) { tecla_especial = true; break; }
}
var chachi = numeros.indexOf(caracter) != -1 || tecla_especial; // Comprobar si la tecla pulsada se encuentra en los caracteres permitidos
return chachi;
}
I also have this, but it does not work: (
function Poner_Punto() {
if(event.keyCode==190) { event.keyCode=188; }
}