Script Categories

Forms >>> Tab Key Emulation.

The tab key is no longer required to tab between fields. The user can go to the next form field just by pressing the enter key instead of the tab key. Useful with 10-key form input.

Box 1:
Box 2:
Box 3:
Box 4:

Add the below code to the <body> section of your page:

<script language="javascript" type="text/javascript">
/* Visit for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin
nextfield = "box1"; // name of first box on page

function onKeyPress(e) {
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.keyCode;
else return true;

if (keycode == 13) {  //enter key pressed
if (nextfield == 'done'){ return true;  }//submit, we finished all fields
else {//  we're not done yet, send focus to next box
eval('document.yourform.' + nextfield + '.focus()');
return false;

document.onkeypress = onKeyPress;
//  End -->
<form name=yourform>
Box 1: <input type=text name=box1 onFocus="nextfield ='box2';"><br>
Box 2: <input type=text name=box2 onFocus="nextfield ='box3';"><br>
Box 3: <input type=text name=box3 onFocus="nextfield ='box4';"><br>
Box 4: <input type=text name=box4 onFocus="nextfield ='done';"><br>
<input type=submit name=done value="Submit">

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.

Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).