I had an interesting challenge today. I have a screen that has multiple text fields and multiple inputs that are actually images (default to submit). There was, by the way, not a single form on this page.
Internet
I decided to trap the enter key and use it for good rather than evil.
The YUI.util has a KeyListener that seemed to be what I was looking for. Yes, I could have just trapped the keypress event myself, but I LIKE to use YUI.
Turns out the documentation on this one is pretty good, but there are no straightforward examples. So, I'll just note here that you want to make sure you declare your KeyListener and then call the enable() method. Otherwise, it dosn't do anything for you.
myListener = YAHOO.util.KeyListener("watchNode", {keys:13}, functionToDo);
myListener.enable();
For some reason, this was not entirely apparent to me. Took me a while to figure it out. Hopefully, I just saved you some time.