You should understand how HTML works and how browsers call and execute JavaScript functions.
<input type="text" ... />
You told the browser to allow all sort of values to be put into the input element.
onkeypress="return event.charCode >= 48 && event.charCode <= 57"
In your HTML snippet, you tell the browser to call and run JavaScript; testing if the event character code of the current key is between 48 and 57. The JavaScript code is valid, and it will return true or false. Whenever your JavaScript code returns false, the browser won't allow the last pressed key the pass as a value for the HTML <input /> element.
Here is the fix.
The input type should be number to allow only numbers as input. onKeyPress=checkID() will invoke your function. By doing so you delegate the input checks up to the browser and get your checkID() function into play.
Or if you really need to control key press events by yourself, because checkID() will be called on every single button press anyways, you could put the character code check at the top of your checkID() function.