We Recommend

Pro JavaScript Techniques Pro JavaScript Techniques
Pro JavaScript Techniques is the ultimate JavaScript book for the modern web developer. It provides everything you need to know about modern JavaScript, and shows what JavaScript can do for your web sites. This book doesn't waste any time looking at things you already know, like basic syntax and structures.


Posted By

nicolaspar on 02/01/07


Tagged


Versions (?)


Javascript - Solo NĂºmeros


Published in: JavaScript 


  1. var nav4SoloNum = window.Event ? true : false;
  2. function soloNum( evento ){
  3. var f = document.formulario
  4. var key = nav4SoloNum ? evento.which : evento.keyCode;
  5. return (key <= 13 || key == 8 || (key >= 48 && key <= 57));
  6. }
  7.  
  8.  
  9. // Ej: <input type="text" name="numero" id="numero" onKeyPress="return soloNum(event);">

Report this snippet 

Comments

RSS Icon Subscribe to comments
Posted By: nicolaspar on February 12, 2008

You need to login to post a comment.