topical media & game development
#javascript-code-04-textarea.js / js
// Find the first <textarea> on the page and bind a keypress listener
document.getElementByTagName(“textarea”)[0].onkeypress = function(e){
// If no event object exists, then grab the global (IE-only) one
e = e || window.event;
// If the Enter key is pressed, return false (causing it to do nothing)
return e.keyCode != 40;
};
(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.