Disable The Enter Key for Text Fields on a Form

Code
function DisableEnterKey(evt) {

   // Get the event object (cross-browser).
   var evt = (evt) ? evt : ((event) ? event : null);

   // Get the source object (cross-browser).
   var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);

   // If Enter pressed on a Textbox, return false.
   if ((evt.keyCode == 13) && (node.type=="text"))  {return false;}

   return true;
}

document.onkeypress = DisableEnterKey; 


If you want to make this apply to only a specific form on your page, change the last line to this:
(Make sure change 'MyForm' to the name of your form.)

Code
document.forms['MyForm'].onkeypress = DisableEnterKey; 



The Captian
Today they call you "crazy". Tomorrow they call you "ahead of your time."
Global Skywatch Learn about Chemtrails - You're breathing them now!
OnlyTheBestHerbs.com World-class supplements
Mercury Talk Why you are sick.
OneUp Domains Domains, Hosting, Email
1-800-358-4278 (U.S. & Canada)