Ladies and Gentlemen, hello. This is my first post here ever.
The following two simple examples are to perform the same task - block numeric input in text field, except one of the works in Opera and the other one doesn't:

Example from W3 Schools - DOES NOT WORK!
HTML Code:
<html>
	<body>
	<script type="text/javascript">
	function noNumbers(e)
	{
		var keynum;
		var keychar;
		var numcheck;	
		if(window.event) // IE
		{
			keynum = e.keyCode;
		}
		else if(e.which) // Netscape/Firefox/Opera
		{
			keynum = e.which;
		}
		keychar = String.fromCharCode(keynum);
		numcheck = /\d/;
		return !numcheck.test(keychar);
	}
	</script>
	<input type="text" onkeydown="return noNumbers(event)" />
	</body>
</html>
Example from MR ED KJ - WORKS!
HTML Code:
<html>
	<body>
	<script type="text/javascript">
	function onKeyPressBlockNumbers(e)
	{
		var key = window.event ? e.keyCode : e.which;
		var keychar = String.fromCharCode(key);
		reg = /\d/;
		return !reg.test(keychar);
	}
	</script>
	<input type="text" onkeypress="return onKeyPressBlockNumbers(event);" />
	</body>
</html>
The scripts were tested under Windows XP Pro SP3 using the following browsers:

  1. Chrome: 2.0.172.43
  2. IE: 8.0.6001. 18702IC
  3. Firefox: 3.0.13
  4. Flock: 2.0.3
  5. Opera: 9.63
  6. Safari 3.2.1 (525.27.1)


Any ideas what the reason may be? There's good chance this problem will be popping up frequently in the future, so it would really help to know what makes those things tick.
Thank you for your time.