Are you using a server side scripting language like ASP or PHP in your form?
Here is the basic idea of you want to do. One thing that you want to account for is the people might want to press enter or backsspace, so you might want to check if the value is not a character, instead of if it IS a number.
var numString; //this keeps track of the valid string
//check the input after a key press
//this gets the value of the key pressed
var aplhaNumericCode=e.keyCode? e.keyCode : e.charCode
//if the key is a number then add it to the number string. (This is not actual js code.)
if(aplhaNumericCode>=65 //*a*/ || aplhaNumericCode>=90//*z*/)
//enter the valid string in the text box (This is not actual js code.)
var num = document.getElementByID("number")
num.text = numString
<input id ="number" type="text" onkeyup="checkinput(event);" />