<head>
<script>
function EnterPress(e){ //传入 event
var e = e || window.event;
if(e.keyCode == 13){
document.getElementById("txtB").focus();
}
}
</script>
</head>
<body>
<input type="text" id="txtA" onkeypress="EnterPress(event)" onkeydown="EnterPress()" />
<input type="text" id="txtB" />
</body>