<script
language="javascript"
type="text/javascript">
nextfield
=
"box1";
function
onKeyPress(e)
{
var
keycode;
if
(window.event)
keycode =
window.event.keyCode;
else
if
(e)
keycode =
e.keyCode;
else
return
true;
if
(keycode
==
13)
{
if
(nextfield
==
'done'){
return
true;
}else
{eval('document.yourform.'
+
nextfield +
'.focus()');
return
false;
}
}
}
document.onkeypress
=
onKeyPress;
</script>
<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">
</form>