日期:2014-05-16 浏览次数:20395 次
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> <SCRIPT LANGUAGE="JavaScript"> <!-- function show(event) { var ev = event || window.event; //回车键对应的ASCII是13,Tab对应的是9 //判断按下回车建的控件类型,不能是reset,submit,textarea和空 if (ev.keyCode == 13 && ev.srcElement.type != "submit" && ev.srcElement.type != "reset" && ev.srcElement.type != "textarea" && ev.srcElement.type != "" ) { ev.keyCode = 9; } } //键盘按下事件 document.onkeydown = show; //--> </SCRIPT> </HEAD> <BODY> <form action="" method="post" name="inputForm"> <input type="text" name="names"><br> <input type="text" name = "txtNames"><br> <input type="button" value="提交"> </form> </BODY> </HTML>