Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function keypressed(obj, e) {
- var tecla = (window.event) ? e.keyCode : e.which;
- var texto = document.getElementById("numeros").value
- var indexvir = texto.indexOf(",")
- var indexpon = texto.indexOf(".")
- if (tecla == 8 || tecla == 0)
- return true;
- if (tecla != 44 && tecla != 46 && tecla < 48 || tecla > 57)
- return false;
- if (tecla == 44) { if (indexvir !== -1 || indexpon !== -1) { return false } }
- if (tecla == 46) { if (indexvir !== -1 || indexpon !== -1) { return false } }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement