Skip to content

Instantly share code, notes, and snippets.

@channingwalton
Created April 29, 2016 21:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save channingwalton/3f5390e4e42854036f457745d7214704 to your computer and use it in GitHub Desktop.
Save channingwalton/3f5390e4e42854036f457745d7214704 to your computer and use it in GitHub Desktop.
positive numbers only
<SCRIPT language=Javascript>
<!--
function isNumberKey(evt)
{
var charCode = (evt.which) ? evt.which : event.keyCode
return charCode > 47 && charCode < 58;
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<INPUT id="txtChar" onkeypress="return isNumberKey(event)" type="text" name="txtChar" maxLength="3">
</BODY>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment