title: Validation of textbox with numbers using javascript
body: <p>How to prevent or validate  the user entering numbers 6 digits with range (eg: 100000) and two decimal digits in a textbox using javascript ?
  I m using <code>onkeypress</code> event in my textbox my code is:</p>
  
  <pre><code>      var txtBudget = document.getElementById('MainContent_txtBudget');
          txtBudget.addEventListener('keypress', function (evt)
          {  
          var value = this.value + String.fromCharCode(evt.which);
          if (!/^\d{0,6}(?:\.\d{0,2})?$/.test(value)) 
             {   
               evt.preventDefault();
             }
         },
   false);​
  </code></pre>