<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
function enterToTab(event, input) {
var e = event?event:window.event;
var form = document.getElementById('form1');
if(e.keyCode == 13) {
var tabindex = input.getAttribute('tabindex');
tabindex++;
var inputs = form.getElementsByTagName('input');
for(var i=0,j=inputs.length; i<j; i++) {
if (inputs[i].getAttribute('tabindex') == tabindex) {
inputs[i].focus();
break;
}
}
}
}
</script>
</head>
<body>
<form id="form1">
<input type="text" tabindex="1" οnkeydοwn="enterToTab(event,this);"/>
<input type="text" tabindex="2" οnkeydοwn="enterToTab(event,this);"/>
<input type="text" tabindex="3" οnkeydοwn="enterToTab(event,this);"/>
<input type="text" tabindex="4" οnkeydοwn="enterToTab(event,this);"/>
<input type="button" value="click me" οnclick="alert('I'm here!')" tabindex="5" οnkeydοwn="enterToTab(event,this);"/>
</form>
</body>
</html>