prueba ahora
Cita: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>Validar entrada de datos</title>
<script type="text/javascript">
function validar2(e, val) {
var key = (e.keyCode) ? e.keyCode : e.charCode;
var val = val + String.fromCharCode(key);
var patron =/^([1-9]|[1][0-2])$/;
return (patron.test(val));
}
</script>
</head>
<body>
<form action="#" onSubmit="javascript:document.form.reset();" method="post">
<p><input type="text" name="textfield" size="2" maxlength="2" onkeypress="return validar2(event, this.value)" /><br />
</p>
<input type="submit" > dale
</form>
</body>
</html>
fíjate que hay que testear el valor del control y la tecla pulsada