<HTML>
<HEAD>
<TITLE> Enter Event </TITLE>
<script language="javascript">
function enterkey()
{
try
{
var el_keydown=window.event.srcElement;
if(event.keyCode==13 && el_keydown.id=="txt1") {
alert(1111);
txt2.focus();
}
else if(event.keyCode==13 && el_keydown.id=="txt2") {
alert(222);
btn.focus();
}
}
catch(e)
{
return;
}
}
</script>
</HEAD>
<BODY>
<input type="text" id="txt1" onkeyDown="enterkey();" ><br>
<input type="text" id="txt2" onkeyDown="enterkey();" ><br>
<input type="button" id="btn" value="button" onClick="alert(txt2.value)" >
</BODY>
</HTML>