[thelist] hack to use Enter instead of Tab on forms

Joe Ngo chilijoe at gmail.com
Mon Feb 7 09:35:18 CST 2005


I'm curious why keyCode needs to be changed by the script whilst
fieldCollection[i+1].focus(); is already doing the job of shifting the
focus to the next form element?

Thanks


On Wed, 2 Feb 2005 21:45:21 -0600, Peter Brunone (EasyListBox.com)
<peter at easylistbox.com> wrote:
> 
>         Yes, it's come up before.  I can't speak to IE/Mac, but I know
> that the easiest way to do this will fail in XP SP2.
> 
>       if (window.event.keyCode == 13) { // window.event is IE object
> model
>          if (!isIE) e.stopPropagation();
>          else {
>                 event.keyCode = 9;  // This line barfs in XPSP2
>                 event.cancelBubble = true;
>                 event.returnValue = false;
>                 }
>          fieldCollection[i+1].focus();
>       }
> 
>         Where the keyCode is set, it's effectively changing the pressed
> key from Enter to Tab.  Too bad it doesn't work in the new, improved
> Windows.  If you can just keep the event from bubbling, you should be
> okay.
> 
> Good luck...
> 
> Peter
>


More information about the thelist mailing list