Posted By

webbral on 12/20/10


Tagged

javascript html validacao mascara


Versions (?)

Máscara Só valores númericos (Only numeric values mask)


 / Published in: JavaScript
 

  1. <script type="text/javascript">
  2. function digitos(event){
  3. if (window.event) {
  4. // IE
  5. key = event.keyCode;
  6. }
  7. else if (event.which) {
  8. // netscape
  9. key = event.which;
  10. }
  11. if (key != 8 || key != 13 || key < 48 || key > 57)
  12. return (((key > 47) && (key < 58)) || (key == 8 ) || (key == 13));
  13. return true;
  14. }
  15. </script>
  16.  
  17.  
  18. <!--Campo Telefone-->
  19. <input type="text" onkeypress="return digitos(event, this);" />

Report this snippet  

You need to login to post a comment.