点击回车取得当点焦点所在控件的ID
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML> <HEAD> <TITLE> New Document </TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> <script type="text/javascript">document.onkeydown = function(evt){var evt = window.event?window.event:evt;if(evt.keyCode==13) {alert(event.srcElement.id);}}</script> </HEAD> <BODY> 用户名: <input type="text" id="user" name="user" />密码:<input type="text" id="password" name="password"/><input type="button" id="submitButton" name="submitButton" value="提交" /> </BODY></HTML>
?