﻿function numbersonly(e) {  
  var unicode = e.charCode ? e.charCode : e.keyCode;  
  //if the key isn't the backspace key (which we should allow)
  if (unicode != 8) {
    //if not a number
    if (unicode < 48 || unicode > 57) {
      //disable key press
      if (navigator.appName == "Microsoft Internet Explorer")
        event.cancelBubble = true;
      return false;
    } //end if
    else {
      // enable keypress      
      return true;
    } //end else
  } //end if
  else {
    // enable keypress    
    return true;
  } //end else
} //end function
