#javascript-code-19-keypress.js / js
// Find all <input> elements in the document var input = document.getElementsByTagName(“input”); for ( var i = 0; i < input.length; i++ ) { // Bind a keypress handler to the <input> element input[i].onkeypress = function(e) { // Prevent the default action, if the user presses the enter key return e.keyCode != 13; }; }
(C) Æliens 20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.