IgnoreEnterKey() - Cause an element to ignore the Enter key.

Code
function IgnoreEnterKey(e) {
	/*
	Purpose
		Used to cause a form element to ignore the Enter key.
	Return (boolean)
		Returns false when the enter key is hit on a hooked element.
	Version History
		1.00 2009.06.29 Tested by Russ Tanner on IE6/FF3.
	*/

	// Get a common event variable (cross-browser).
	if (!e) var e = window.event;

	// Get the key code that was pressed (cross-browser).	
	if (e.keyCode) kc = e.keyCode;
	else if (e.which) kc = e.which;

	// Don't let this event propagate (performance optimization).
	if (e.stopPropagation) e.stopPropagation();

	// Return false if the enter key was pressed.
	return ! (kc == 13);
	
}



Here's how you hook the element into this function:

Code
frm.elements['MyFormElement'].onkeypress = IgnoreEnterKey;
if (frm.elements['MyFormElement'].captureEvents) frm.elements['MyFormElement'].captureEvents(Event.KEYPRESS);


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)