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

Chris Hayes chris at lwcdial.net
Thu Feb 3 09:21:23 CST 2005


I'm missing the original.

Why would anybody want to use Enter instead of TAB?

Could you be breaking accessibility?


----- Original Message ----- 
From: "Norman Bunn" <norman.bunn at craftedsolutions.com>
To: <thelist at lists.evolt.org>
Sent: Thursday, February 03, 2005 1:44 PM
Subject: Re: [thelist] hack to use Enter instead of Tab on forms


> Here is one I picked up a while back off the Dynamic Drive site.
> 
> /***********************************************
> * Disable "Enter" key in Form script- By Nurul 
> Fadilah(nurul at REMOVETHISvolmedia.com)
> * This notice must stay intact for use
> * Visit http://www.dynamicdrive.com/ for full source code
> ***********************************************/
>                
> function handleEnter (field, event) {
>         var keyCode = event.keyCode ? event.keyCode : event.which ? 
> event.which : event.charCode;
>         if (keyCode == 13) {
>             var i;
>             for (i = 0; i < field.form.elements.length; i++)
>                 if (field == field.form.elements[i])
>                     break;
>             i = (i + 1) % field.form.elements.length;
>             field.form.elements[i].focus();
>             return false;
>         }
>         else
>         return true;
>     }     
> 
> Just add
> 
> onkeypress="return handleEnter(this, event)
> 
> to each field and you are done.
> 
> Norman
> 
> ---
> 
> Norman W. Bunn
> norman.bunn at craftedsolutions.com
> 803.405.1008
> ----------------------------------------------
> www.CraftedSolutions.com
> Crafted Solutions, Inc.
> Web Design & Development
> Web Site Hosting & Custom Solutions
> "Get the results the Internet promises;
>  get the 'Net Result' from Crafted Solutions!"
> ----------------------------------------------
> 
> 
> -- 
> 
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
> 
> For unsubscribe and other options, including the Tip Harvester 
> and archives of thelist go to: http://lists.evolt.org 
> Workers of the Web, evolt !


More information about the thelist mailing list