To restrict the number of alphabets or numbers inside an input field on your html form simply use maxlength attribute.
For example:
<input type="text" name="myinput" maxlength="10" value="" />
This will restrict the user to enter only upto 10 characters in the input field. It is cross browser compatible and works in firefox, internet explorer and chrome, all perfectly.