<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Fenstertitel</title>
<style type="text/css"></style>
</head>
<body>
<input id="input">
<script type="text/javascript">
document.getElementById("input").addEventListener("keypress", function(ev){
if (!String.fromCharCode(ev.charCode).match(/^\d$/)){
ev.preventDefault();
}
});
</script>
</body>
</html>